+ 1

How can i correct it? My output>>>11 : 00;expect output>>> 11:00

a=input() b=a.split(' ') c=b[0].split(':') d=c[0] d=int(d) if d==12 and b[1]=='PM': d=12 elif d==12 and b[1]=='AM': d=24 elif b[1]=='PM': d+=12 else: d=d print (d,':',c[1])

20th Feb 2020, 7:59 PM
Hamed
3 Answers
+ 3
The problem is that print(d, ':', c[1]) By default the print function uses spaces a separators. You can specify to use '' as separator (no actual separator) by doing this: print(d, ':', c[1], sep = '') You can only do this in Python 3.X
20th Feb 2020, 8:35 PM
Álvaro Estévez López
Álvaro Estévez López - avatar
+ 3
There is no way of telling where the mistake is if we can't see the code. Please make sure to link your code next time.
20th Feb 2020, 8:22 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
try with format print. or print(str(d) +":" +c[1])
20th Feb 2020, 8:34 PM
Oma Falk
Oma Falk - avatar