number
ユーザーが正しい数を推測した場合、変数を増加させようとしています! そして、他のユーザーに推測された場合は、増加したものを増やし続けます。しかし、それは私のsyntax
間違っているようです。だから私は本当にあなたの助けが必要です。以下は私のコードです:
#!/usr/bin/python
# Filename: while.py
number = 23
running = True
while running:
guess = int(raw_input('Enter an integer : '))
if guess == number:
print 'Congratulations, you guessed it. The number is now increase'
number += 1 # Increase this so the next user won't know 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'