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

Hi there! I'm working on py5, the Ghost program, and am stumped on one of my functions. I simply can't figure out why this function is so unpredictable in what it returns for the value of 'letter'. It returns a good value if all goes well, but if I deliberately enter an invalid input and expect it to rerun the function (thus presumably getting a new value to pass) it returns a value of 'None.' I don't see why this should be. Can anyone take a look at this and give me a hint? (The function in question is letter_check, but I've included my rudimentary test play_hand shell in case it helps....)

OpenStudy (anonymous):

http://dpaste.com/596715/ (Would be nice if I'd include it, huh? Sorry!)

OpenStudy (anonymous):

In the else clause inside letter_check(), use 'return letter_check()' rather than 'letter_check()'. On an illegal char, your function will continue until a legal char is entered, but you don't have a return value.

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!