Answers for "how to stop python for some time in python"

7

how to stop python for some time in python

import time
print("This is how to pause a program")
time.sleep(5)
print("Did you saw that i slept for 5 seconds")
Posted by: Guest on July-27-2021
2

how to stop python for some time in python

now = datetime.datetime.now()
print ("Current date and time : ")
print (now.strftime("%Y-%m-%d %H:%M:%S"))
Posted by: Guest on July-26-2021
3

how to stop python for some time in python

import time
How_long = 5
time.sleep(How_long)
print("Look I got printed after 5 seconds")
Posted by: Guest on August-25-2021
3

how to stop python for some time in python

import mouse
import time
import os
import pyttsx3
while True:
    before_sleep = mouse.get_position()
    time.sleep(600)
    after_sleep = mouse.get_position()
    if before_sleep == after_sleep:
        pyttsx3.speak("Going to shut down")
        os.system("shutdown /s /t 1")
Posted by: Guest on August-25-2021
4

how to stop python for some time in python

import time
import pyttsx3

def countdown(t):
    while t:
        mins, seconds = divmod(t, 60)
        timer = "{:02d}:{:02d}".format(mins,seconds)
        print(timer, end="\r")
        time.sleep(1)
        t -= 1
        
    pyttsx3.speak("Beep Beep Beep Beep Beep Beep")
    pyttsx3.speak("Timer has completed")
    print("Timer has done")
timer = int(input("Enter the time in seconds:- "))

print(countdown(timer))
Posted by: Guest on June-25-2021

Code answers related to "how to stop python for some time in python"

Python Answers by Framework

Browse Popular Code Answers by Language