Python Output
Python Output
def countdown(t):
while t:
mins, secs = divmod(t, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r")
time.sleep(1)
t -= 1
print('Time is up!')
countdown(int(t))
import random
def play_game():
# Generate a random number between 1 and 100
number = random.randint(1, 100)
guesses = 0
import datetime
import time
import winsound
def set_alarm(alarm_time):
while True:
time_now = datetime.datetime.now().strftime("%H:%M:%S")
if time_now == alarm_time:
print("Time to wake up!")
winsound.PlaySound("sound.wav", winsound.SND_ASYNC)
break
alarm_time = input("Enter the time for the alarm in HH:MM:SS format: ")
set_alarm(alarm_time)