[Tutor] while loop problem
Lie Ryan
lie.1296 at gmail.com
Mon Mar 9 06:51:28 CET 2009
mustafa akkoc wrote:
> hello i have syntax problem in this program
>
<snip>
>
After correcting the indentations, and putting a missing parentheses in
line 24 (the last line), I don't see any Syntax Error.
#!/usr/bin/python
# Filename: while.py
number = 23
running = True
while running :
guess= int(input('Enter an integer : ')) # it give a syntax error
this line can you me ?
if guess == number:
print('Congratulations, you guessed it.')
running = False # this causes the while loop to stop
elif guess < number:
print('No, it is a little higher than that.')
else:
print('No, it is a little lower than that.')
else:
print('The while loop is over.')
# Do anything else you want to do here
print('Done') # you missed a paren, probably CopyPasteError
More information about the Tutor
mailing list