Menu Close

Display Time

Time Challenge to display hours minutes and seconds in both 12 and 24 hours format.
24 hours format: 23:30:12 Standard format: 11:30:12 pm.

Hour=int(input("Hour: "))
Min=int(input("Min: "))
Sec=int(input("Sec: "))
r=Hour-12

if Hour>12:
	print("24 Hours Format\n{}:{}:{}".format(Hour,Min,Sec))
	print("24 Hours Format\n{}:{}:{} PM".format(r,Min,Sec))

else:
	print("24 Hours Format\n{}:{}:{}".format(Hour,Min,Sec))
	print("24 Hours Format\n{}:{}:{} AM".format(Hour,Min,Sec))

Exec. on linux

Morae!Q!