[Tutor] Help with "Guess the number" script

Ben Finney ben+python at benfinney.id.au
Sat Mar 1 08:47:46 CET 2014


Scott W Dunning <swdunning at cox.net> writes:

> def get_guess(guess_number):
>     print "(",guess_number,")""Plese enter a guess:"
>     current_guess = raw_input()
>     return int(guess_number)

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.

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.

-- 
 \      “The most merciful thing in the world… is the inability of the |
  `\        human mind to correlate all its contents.” —Howard Philips |
_o__)                                                        Lovecraft |
Ben Finney



More information about the Tutor mailing list