Scott W Dunning <swdunn...@cox.net> Wrote in message: > > On Mar 1, 2014, at 12:47 AM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > >> You've bound the name âcurrent_guessâ to the user's input, but then do >> nothing with it for the rest of the function; it will be discarded >> without being used. > Hmm, Iâm not quite sure I understand. I got somewhat confused because the > directions were changed a little and current_guess was removed from the > get_guess function. Is this more like what I should be doing? > > def get_guess(guess_number): > raw_input(âPlease enter a guessâ) > guess_number = int(guess_number) > return (guess_number)
That block of code is a huge step backwards from what you already had. So let's go back a step. def get_guess(guess_number): Â Â print "(",guess_number,")""Plese enter a guess:" Â Â current_guess = raw_input() Â Â return int(guess_number First thing to do is decide what that function is 'supposed' to do. What do you suppose a caller might expect as a return value? Once you've decided a description, write it down as a set of comments (or docstring, but that's another lesson). > >> >> Then, you use the parameter âguess_numberâ, create a new integer from >> it, and return that integer. I think you've used the wrong name for the >> âint()â parameter. > Well, since there are no loops allowed Iâm guessing get_guess will be > called 9 times. It will be called (up to) 9 times even after you learn about loops. It's called get_guess, not get_guesses. > I believe guess_number is the number of tries the user has used. > So; > (1) Please enter a guess: > (2) Please enter a guess: If that's a specification, then add it to your comments above. I would guess you're missing a print in the function. -- DaveA
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor