repl.it
@Tom_Becks07/

24 hour to digital calculator

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
print("Welcome to the 24 Hour to digital time converter")
choice=input("""Would you like to do:
  A)Digital to 24 hour
  B)24 hour to Digital
  :""")
if choice=="A":
  hour=int(input("Enter the time of day in the digital clock : "))
  dayperiod=input("Is it AM or PM? : ")
  if dayperiod=="AM":
    hour=hour+12
  print("The time is",hour,"on the 24 hour clock")
elif choice=="B":
  hour=int(input("Enter the time of the day in the 24 hour clock : "))
  if hour<12:
    dayperiod="am"
  else:
    dayperiod="pm"
    hour=hour-12
  print("The time is",hour,dayperiod)
  
Fetching token
?