How to make one of those cool timers
This file cannot be displayed: https://media.istockphoto.com/vectors/stopwatch-timer-sport-illustration-vector-id928319756?s=612x612
Welcome to my super FUN(boring) timer python tutorial!
Now of course the first thing you have to do is import time, it is a timer
import time
After you import time, you should make an input to find the time.
import time seconds=int(input("How many seconds for your timer?:"))
Great but import time is unused making it literally just an input for something that will never happen.So we should fix that.
import time seconds=int(input("How many seconds for your timer?:")) for i in range(seconds):
Great, now we have a range, but it still is just an input because the range has nothing inside it
import time seconds=int(input("How many seconds for your timer?:")) for i in range(seconds): print(str(seconds - i) + " seconds left")
Yay. Now it should be done. But it isn't. Because it will go down by 1 second and then end.It should go down to zero so now one line of code should do that and now it isn't
update()
Actually now is when we use import time.
import time seconds=int(input("How many seconds for your timer?:")) for i in range(seconds): print(str(seconds - i) + " seconds left") time.sleep(1)
Nice.Now we have a full working seconds timer.THanks for reading.Upvote if you want to.Bye!
You used the wrong symbol for code blocks D: Use backticks ` instead of single quotes
Also, the syntax highlighting code is
py
notpython