Please help me het the error in my python code... I am trying to convert time from 12hour fromat to 24hour. Inputs r with AM/PM | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Please help me het the error in my python code... I am trying to convert time from 12hour fromat to 24hour. Inputs r with AM/PM

time = input() time.split(':ampm ') hour = int(time[0]) minute = int(time[1]) if hour < 12: hour += 12 print (f"{hour}:{minute}")

28th Sep 2021, 1:13 PM
El_ahmady
El_ahmady - avatar
2 Réponses
+ 1
Is your input like 2am or 2:ampm
28th Sep 2021, 1:36 PM
Prabhas Koya
0
The input is like: 1:30 am Output: 13:30
28th Sep 2021, 1:40 PM
El_ahmady
El_ahmady - avatar