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

python while循环

2017-11-16 09:22 155 查看
count = 0
answer = 10

while True:
print(count)
count += 1
guess = int(input('猜一个'))
if guess == answer:
print('ok')
break
elif guess > answer:
print('猜大了')
else:
print('猜小了')

if count ==10:
break
print('第二个while')
count = 0
while count <3:
count +=1
guess = int(input('猜一个'))
if guess == answer:
print('ok')
break
elif guess < answer:
print('猜小了')
else:
print('猜大了')
else:
print('机会用完了')

  

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