Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import libraries
- from time import sleep
- #set countdown function to divide time in seconds by 60 to find minutes; modulo time by 60 to find leftover seconds, then sleep and print Game Over if t = 0
- def countdown(t):
- while t > 0:
- mins = str(int(t / 60))
- sec = str(t % 60)
- print("Minutes: " + mins + ", Seconds: " + sec)
- t = t - 1
- sleep(1)
- if t == 0:
- print("Game Over")
- #start countdown
- countdown(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement