while.py
来自「python简明教程源代码」· Python 代码 · 共 21 行
PY
21 行
# Filename : while.py
number = 23
running = True
while running:
guess = int(raw_input('Enter an integer :'))
if guess == number:
print 'Congratulations, you guessed id.'
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'
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?