请问这个代码应该怎样写?(一个Tommy猫的游戏,求用Python编写

https://www.docin.com/p-2121031113.html
其中提到的timer模块如下:

import threading
import time
 
def fun_timer():
    global timer, hours
    hours += 1
    if hours > 23:
        hours = 0
    
    timer = threading.Timer(5.0, fun_timer) #5s执行一次fun_timer
    timer.start()
 
 
def main():
    global hours
 
    hours = 0
    fun_timer()  #启动定时器
    while True:
        print()
        command = input("Command:")
        if command == "print":
            print("Now is %-2d"%hours)
        elif command == "quit":
            print("Bye.....")
            timer.cancel()
            break
 
 
   
 
if __name__ =="__main__":
    main()