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

Ugh, I can't seem to get this retrice done without some help. I am on pset5, problem #5, here is the code for play_ghost(): http://codepad.org/DYLtPiRj For some reason I can't seem to escape that first while loop, I will provide a sample output in a subsequent post. Any thoughts?

OpenStudy (anonymous):

Loading word list from file... 83667 words loaded. 83667 Player 1 says letter: p Current word fragment: p valid word False invalid frag False Player 2 says letter: y Current word fragment: py valid word False invalid frag False Player 1 says letter: n Current word fragment: pyn valid word False invalid frag True >>> As you can see, once invalidFrag = True, the program stops, but it doesn't go on to the if statements below. The same is true for when validWord = True. Thanks!

OpenStudy (anonymous):

look at it again real close and think about a previous mistake you made then if you still don't see it ... http://codepad.org/cX8Zstr4

OpenStudy (anonymous):

OMG! bwCA once again you save me. Thank you very much!

OpenStudy (anonymous):

so, the way that i found that was to put a print statement after line 25 & 30 (print 'validWord', print 'invalidFrag'); everything up to that point looked like it should work so i thought maybe somehow those if statements weren't working. the print statements let me see that those if statements were working so i looked closer and saw the mistake. sprinkling print statements around your code is a useful debug technique - print variables, results of tests or calculations... it lets you see how your code is executing and you can see if it jives with how you thought it would be executing.

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!