作者jimmycoco (JIMMY)
看板Python
标题[问题] 自学新手的一个问题
时间Sun Jan 22 22:36:19 2012
number = 23
running = True
while running:
guess = int(raw_input('Enter an integer : '))
if guess == number:
print 'Congratulations, you guessed it.'
running = False # this causes the while loop to stop
elif guess < number:
print 'No, it is higher than that.'
else:
print 'No, it is lower than that.'
else:
print 'The while loop is over'
print 'Done'
请问 在running = False # this causes the while loop to stop
这边会让回圈停止 为什麽啊??
麻烦各位高手为小弟解惑 顺便一问PYTHON 的学习手册有二手或那里租的到吗?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.45.87.106
1F:→ uranusjr:while 後面的陈述为 False 时, 会跳出 while block 01/22 22:41
2F:→ yudsx:设定成False之後,下次执行到回圈判断就会跳出回圈 01/23 23:39
3F:→ jimmycoco:了解了 谢谢 01/24 11:42