a page one day 5

#! /usr/bin/python
# Filename : pythonwhile.py

number = 20
running = True

while running :
    guess = int(raw_input('Enter an integer:'))
    if guess == number :
        print 'you got it,dude'
        running = False
    elif guess < number :
        print 'it is a little higher than what you guess just now'
    else :
        print 'it is a little lower than what you guess just now'
else :
    print 'the while loop is over.'

print 'over'

the outcomes are :Enter an integer:19
it is a little higher than what you guess just now
Enter an integer:21
it is a little lower than what you guess just now
Enter an integer:20
you got it,dude
the while loop is over.
over
 

 

你可能感兴趣的:(a page one day 5)