0

what is the problem Military Times

t = input().split(":") if t[1][:-3:-1][::-1] == "PM": mt = f"{int(t[0])+12}:{t[1][0:2]}" else: mt = f"{t[0]}:{t[1][0:2]}" print(mt)

31st Aug 2020, 1:16 PM
Sayed Ajmal Hashimi
Sayed Ajmal Hashimi - avatar
2 Respuestas
+ 1
You need to add 0(zero) in front of 1-9
31st Aug 2020, 1:22 PM
Shadoff
Shadoff - avatar
+ 1
thank you so much: t = input().split(":") if t[1][:-3:-1][::-1] == "PM": mt = f"{int(t[0])+12}:{t[1][0:2]}" else: mt = f"{0 if int(t[0])<10 else ''}{t[0]}:{t[1][0:2]}" print(mt)
31st Aug 2020, 2:39 PM
Sayed Ajmal Hashimi
Sayed Ajmal Hashimi - avatar