i am doing a python project and i wanna compare a string to a list of keys and values - if all the keys were to match up a certain number of times with a word string, it should return True for example -
def compareTo(word, hand):
kal = False
for d in wordlists:
if d in word:
kal = True
return kal
it always returns false how can i make it return true?!? please help!!!
so if
word = "hammer"
and
hand = {'a': 1, 'h': 1, 'r': 1, 'm': 2, 'e': 1}
values represent the frequency of each letter if I insert parameters which are true, how can I make it return true and not false...
comapreTo("hammer",{'a': 1, 'h': 1, 'r': 1, 'm': 2, 'e': 1})
should return True and not False and comapreTo("hammers",{'a': 1, 'h': 1, 'r': 1, 'd': 2, 'e': 1}) should return false and not true!