Respuesta :
Answer:
The program written in Python is as follows;
time_now = int(input("Time: "))
wait_time = int(input("Alarm: "))
time_now = time_now + wait_time%24
if time_now < 12:
print(str(time_now)+"am")
else:
time_now = time_now - 12
print(str(time_now)+"pm")
Explanation:
This line prompts user for current time
time_now = int(input("Time: "))
This line prompts user for the alarm hours
wait_time = int(input("Alarm: "))
This line calculates the time of the alarm
time_now = time_now + wait_time%24
The following if statement determines if the time will be am or pm
If the time is less than 12, then the time will be in am
if time_now < 12:
print(str(time_now)+"am")
If otherwise, then the time will be in pm
else:
time_now = time_now - 12
print(str(time_now)+"pm")