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

In ps5, I've got a little problem with the display in part 4 'Playing a hand'. That's what I get on my screen: Loading word list from file... 83667 words loaded. play_game not implemented. Current Hand: display hand: begin a e k p r t x display hand: end None Enter word, or a . to indicate that you are finished: . Total score: 0 points. I can't find where this 'None' comes from ! Here is the code (It's just the relevant part of my code): http://codepad.org/9HVnekat

OpenStudy (anonymous):

The display hand function as it is written does not return anything- it simply prints the letters of your hand to screen. Therefore, when you put it in the print statement, it executes its own printing, but returns a None that the print statement then evaluates and prints to screen. Try taking your display_hand(hand) out of the print statement (again since it returns NOTHING (officially defaulting to a none), and the print statement evaluates that none). Something like this should work: print 'Current Hand: ', display_hand(hand)

OpenStudy (maitre_kaio):

Nice catch ! Thanks for your help ! Bad habits of a Java developer :)

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!