1now = datetime.datetime.now()
2print ("Current date and time : ")
3print (now.strftime("%Y-%m-%d %H:%M:%S"))
1import time
2print("This is how to pause a program")
3time.sleep(5)
4print("Did you saw that i slept for 5 seconds")
1import mouse
2import time
3import os
4import pyttsx3
5while True:
6 before_sleep = mouse.get_position()
7 time.sleep(600)
8 after_sleep = mouse.get_position()
9 if before_sleep == after_sleep:
10 pyttsx3.speak("Going to shut down")
11 os.system("shutdown /s /t 1")
1import time
2How_long = 5
3time.sleep(How_long)
4print("Look I got printed after 5 seconds")
1import time
2import pyttsx3
3
4def countdown(t):
5 while t:
6 mins, seconds = divmod(t, 60)
7 timer = "{:02d}:{:02d}".format(mins,seconds)
8 print(timer, end="\r")
9 time.sleep(1)
10 t -= 1
11
12 pyttsx3.speak("Beep Beep Beep Beep Beep Beep")
13 pyttsx3.speak("Timer has completed")
14 print("Timer has done")
15timer = int(input("Enter the time in seconds:- "))
16
17print(countdown(timer))