问题描述
block*
所以我为测验设置了计时器,但问题是我无法从用户那里得到关于实际问题的输入,因为回车符#Quiz Timer
def countd(seconds):
global mins
mins = seconds
while True:
m,s = divmod(mins,60)
mins -= 1
global timer
timer = str(m).zfill(2) + ':' + str(s).zfill(2)
print("Time left: ",timer,end = '\r') #problem***
time.sleep(1)
if mins == 0:
print("Time's up! You were too slow.")
break
if resp == "Y": #if user inputs 'Y' timer will start
countdown_thread = threading.Thread(target=countd,args=(600,))
countdown_thread.start()
#Questions
while mins > 0:
a1 = input("Q1. Name all seven colours of the rainbow.\n\n").lower()
计时器的while循环保持覆盖任何输入。有办法克服吗?
我需要回车才能将计时器保持在一个位置**
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)