您的位置:首页 > 编程语言 > Python开发

python学习笔记之004.py

2017-08-10 23:08 399 查看
#!/usr/bin/env python

# coding=utf-8

# Created Time:    2017-08-07 12:39:38

# Modified Time:   2017-08-08 13:10:17

number = 23

running = True

while running:

    guess = int(raw_input('Enter an integer : '))

    if guess == number:

        print 'Congratulations,you guessed it.'

        running = True # this causes the while loop to stop

    elif guess < number:

        print 'No,it is a little higher than that'

        running = True

    else:

        print 'No,it is a little lower than that'

        running = False

else:

    print 'The while loop is over.'

    # Do anything  else you want to do here

print 'Done'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: