How to make a timer program in Python

前端 未结 11 2241
予麋鹿
予麋鹿 2021-02-08 14:24

Here is my goal: To make a small program (text based) that will start with a greeting, print out a timer for how long it has been since the last event, and then a timer for the

11条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-08 15:04

    I have a better way:

    import time
    s=0
    m=0
    while True:
      print(m,  'minutes,', s, 'seconds')
      time.sleep(0.999999999999999999999) # the more 9s the better
      s += 1
      if s == 60:
        s=0
        m += 1
    

提交回复
热议问题