Assignment 5: Problem #3. I understand how to compare the word with word_list, but I'm struggling a little with comparing it with hand. What happens when a word has too many letters for a value in the dict ? (word=hello, while hand includes l:1 (instead of l:2)
well, then you can't make that word with that hand. are you having trouble with the actual comparison? could you turn the word into a letter-frequency dictionary then compare the two dictionaries? or possibly use the count function with the word? ... i.e. 'hello'.count('l') returns 2.
I'll try both ! :)
I created a copy of the dictionary, for each letter in the WORD I took it out of the copy of the hand dictionary, then checked if the letter was less then zero (l:-1), i've attached my is valid word function if you want to take a look
hey, if you could put your code on dpaste.com, it would be a lot more accessible so people can look at it
Join our real-time social learning platform and learn together with your friends!