+ 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])
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
+ 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.
+ 1
try with format print.
or
print(str(d) +":" +c[1])