怎么用Python计时
零基础Python第4课怎么用计时功能
可以用计时来倒计时游戏
只给1分钟答数字
???
谢谢{:5_91:} {:7_112:}
import random
what = random.randint(1,10)
temp=input("Guess a number, one to ten:")
guess=int(temp)
while guess != what:
temp=input("The number is wrong,try again:")
guess=int(temp)
if guess==what:
print("You got it")
else:
if guess>what:
print("Too big")
else:
print("Too small")
print("I don’t want to play anymore, bye ^_^")
一个账号 发表于 2020-3-5 11:07
达不到这种效果,input() 会堵塞线程
好
怎么用???{:5_109:} 一个账号 发表于 2020-3-5 11:07
达不到这种效果,input() 会堵塞线程
什么意思?{:10_266:} ddyyff 发表于 2020-3-5 11:11
什么意思?
input() 会堵塞线程,要用多线程 ddyyff 发表于 2020-3-5 11:11
什么意思?
如果想实现,就必须要用多线程
而input会阻塞其他的线程(不让他们继续),
所以计时有可能不准
页:
[1]