Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 19 Online
OpenStudy (anonymous):

can anybody please point me to soultions for ps5?

OpenStudy (anonymous):

Maybe you could elaborate on what issue you're having, and one of us could try to help?

OpenStudy (anonymous):

I am working on it now. What problem are you having exactly?

OpenStudy (anonymous):

http://codepad.org/brWtzej4 this is my code for update_hand and is_valid_word. I assumed that in order to not mutate the hand i had to create a copy and used the dictionary.copy() method. i read somewhere that this method is rarely used so i wanted to see alternative implementations. thanks for your help guys

OpenStudy (anonymous):

If you take a look at how they are testing update_hand, your function shouldn't mutate hand no matter what: hand2 = update_hand(hand.copy(), word) So, if I understand this right, you don't have to worry about mutating hand because what you return out of the function becomes hand2. That being said, you can really simplify your code down to similar to your lines 19-20. Here's what I got: for letter in word: hand[letter] = hand[letter] -1 return hand I'm working on is_vailid_word now so I'll let someone else take a look at yours or come back latter. Hopefully this helps!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!