1
I’m trying to do an exercise on functions, in Python, with the following statement: "Make a program that converts from 24-hour notation to 12-hour notation". Example: Convert 14:25 to 2:25 PM. The program must contain two functions, one that converts the time and one that prints the time (with AM or PM).
I’ve reached a certain point, but now I’m in doubt as to why the program isn’t running.
My show:
hora = int(input("Digite a hora: "))
minuto = int(input("Digite os minutos: "))
def converter_hora(hora):
return (hora -12)
def imprime_hora(hora,minuto):
if(hora <= 12):
print(hora,minuto,"AM")
else:
print(converter_hora,minuto,"PM")
print(imprime_hora)
Python is returning the following message:
Function imprime_hora at 0x02D8C0C0
Any suggestions?