# Alarm Clock Program Using Python

Many people keep time using a 24 hour clock (11 is 11am and 23 is 11pm, 0 is midnight). If it is currently 13 and you set your alarm to go off in 50 hours, it will be 15 (3pm). Write a Python program to solve the general version of the above problem. Ask the user for the time now (in hours), and then ask for the number of hours to wait for the alarm. Your python program should output what the time will be on the clock when the alarm goes off. Using python

Solution:

```actualTime = int(input("Enter actual time: "))
alarmTime = int(input("Enter alarm time: "))
if(actualTime<=alarmTime):
m1 = actualTime%100
h1 = actualTime//100
m2 = alarmTime % 100
h2 = alarmTime // 100
res = (m2-m1) + (60*(h2-h1))
print("Alarm will ring in",res,'minutes')
else:

$\color{blue}\underline{Output:}$

• Rasha

this is a very good website

• maani

I have 50 questions for the same test your page is showing only 28

• joeanne

• joeanne

hi can anyone help or guide me to my assignments. thanks

• Monik

• Cristina

This solution is perfect ...thanks

• Janete

Hello Allison,I love the 2nd image that you did! I also, had never heard of SumoPaint, is something that I will have to exolpre a bit! I understand completely the 52 (or so) youtube videos that you probably watched. Sometimes they have what you want, sometimes they don't! However, it is always satisfying when you are able to produce something that you have taught yourself. Great job!Debra 0 likes

• Sandeep

Perfect bank of solution.

• Oxana

great !

• Paul Brandon-Fritzius

thanks for the quick response. the solution looks good. :)

• tina Johnson

thnx for the answer. it was perfect. just the way i wanted it.

• Giuseppe

works fine.