我正在为休息时间设置休息计时器,如果 声明为真
我尝试将其保留在前面的if语句之外 我也尝试使用括号
class Timer(object):
sec = 0
minutes = 0
hours = 0
while True:
seconds = 5 - sec
sec = (sec + 1) % 60
os.system("cls")
print("You have {hours} hours {minutes} minutes {seconds} seconds until
your next smoke break\n".format(hours=hours, minutes=minutes, seconds=seconds))
time.sleep(1)
if seconds == 0:
minutes -= 1
seconds = 59
if minutes <= 0:
hours -= 1
minutes = 59
seconds = 59
if seconds <= 0 and minutes <= 0 and hours <= 0:
print("Break Time!")
hours = 0
seconds = 0
minutes = 0
break
我希望输出结果为true,但实际输出为false