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....)
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.
Join our real-time social learning platform and learn together with your friends!