How to create a countdown timer in Pydroid 3 . Python in android

 Let's make a countdown timer in Python 

First we need to import time 

Import time 

This will allow us to use time function , such as the sleep {} function

Next lest ask the user how many seconds we want to count down from 

Seconds = int(input("how many seconds to wait"))

Next let's use a ranged loop yo count downwards 

For I in range(seconds):

      Print(str(seconds - i)+"seconds remain")

We also need to have Python sleep for 1 second between each iteration 

Time.sleep(1)

Let's try it 

And our program end

Print("time is up")

Example :- 


import time
seconds = int(input("how many seconds to wait"))
for i in range(seconds):
	print(str(seconds - i) + "seconds remain")
print("time is up")

Post a Comment

0 Comments