Talk:Non-Programmer's Tutorial for Python 2.0/Decisions
From Wikibooks, the open-content textbooks collection
Shouldn't this part
number = 42
guess = 0
count = 0
while guess != number:
count = count + 1
guess = input('Guess a number: ')
if guess > number:
print 'Too high'
elif guess < number:
print 'Too low'
if count > 3:
print 'That must have been complicated.'
else:
print 'Just right'
be something like this:
# Plays the guessing game higher or lower
# This should actually be something that is semi random like the
# last digits of the time or something else, but that will have to
# wait till a later chapter. (Extra Credit, modify it to be random
# after the Modules chapter)
number = 72
guess = 0
wrong = 0
while guess != number:
guess = input ("Guess a number: ")
if guess != number:
wrong = wrong + 1
if guess > number:
print "Too high"
elif guess < number:
print "Too low"
print "Just right"
if wrong > 3:
print "That must have been complicated."
because i think in the first version you actually have to enter 2 wrong numbers to get that message