Skip to content

Instantly share code, notes, and snippets.

@mikleg
Created April 9, 2017 20:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikleg/b6124b06d4f5f4abe48992bea5056af2 to your computer and use it in GitHub Desktop.
Save mikleg/b6124b06d4f5f4abe48992bea5056af2 to your computer and use it in GitHub Desktop.
Alarm set calculator. 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). A Python program to solve the general version of the above problem.
time_now=float(input("please enter time now"))
alarm_set=float(input("please enter the number of hours to wait for the alar"))
print("the time will be:", (time_now+alarm_set)%24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment