weiliu 发表于 2015-12-28 13:07
-*- coding: utf-8 -*-
import random#似乎也可以这样
secret=random.randint(1,100)
xiaohuzai 发表于 2015-2-8 14:32
from random import randint
num = randint(1,100)
print "Guess what I think?"
weiliu 发表于 2015-12-28 13:07
-*- coding: utf-8 -*-
import random#似乎也可以这样
secret=random.randint(1,100)
AA.JPG (27.17 KB, 下载次数: 507)
from random import randint
num = randint(1,100)
answer = 101
while answer != num:
print("Guess what I think?")
answer = int(input())
if answer < num:
print("too small,just guess again")
if answer > num:
print('too big,just guess again')
if answer == num:
print("Congratulations,guess right")
num = randint(1,100)
print("Do you want to go on ?")
answer1 = input()
if answer1 == "yes":
continue
elif answer1 == "no":
print("Goodbye....")
break
else:
continue
欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/) | Powered by Discuz! X2.5 |