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

Problem set 3 I'm working on this: http://pastebin.com/RwMRZzWr Specifically, I'm working on the 'play_hand' function. I'm trying to put all the functions I have into a workable game. The game is scrabble, btw. I'm trying to create a loop that runs as long as a hand exists. The hand is a dictionary (keys are letters and values are # of instances), and for each word submitted, the letters are deleted from the dictionary. How do I write a statement basically saying "while 'hand' has any value > 1, do this"? Thanks in advance!

OpenStudy (anonymous):

at line 234 you set n = len(hand) Can you just use while n > 1 at that point if you update n each time you play a word? I think some combination like while (n > 1) and (word != '.') would likely do the trick

OpenStudy (anonymous):

how about: while max(dictionary.values()) > 0 http://dpaste.com/786132/

OpenStudy (anonymous):

kudos bwCA. Worked perfectly. Appreciate the help :)

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!