引入了time.sleep,强制延时1s
#!/usr/bin/env python3
import random
import time
start = 0
end = 99
boom = random.randint(0, 99)
while 1==1:
people = int(input("填入{}到{}之间的数".format(start, end)))
if people > boom :
print("大了")
end = people
elif people < boom :
print("小了")
start = people
else:
print("BOOM!")
break
print("等待电脑输入{}到{}之间的数".format(start, end))
time.sleep(1)
com = random.randint(start, end)
print("电脑输入为{}".format(com))
if com > boom :
print("大了")
end = com
elif com < boom :
print("小了")
start = com
else:
print("BOOM!")
break
|