博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

python学习笔记(一)

Posted on 2012-10-19 23:35  bug yang  阅读(188)  评论(0编辑  收藏  举报

1、流程控制

#!/usr/bin/python
#filename:test.py

number = 23
running = True
while running:
    guess = int(raw_input('Enter an integer: '))
    if guess == number : 
     print "congratulations,you guess it."
     print "(but you do not win any prizes!)"
     running = False
    elif guess < number: 
     print "No,it is a litter higher than that"
    else :
     print "No,it is a litter lower than that"
else:
    print "The while loop is over"
print "Done"