python solution ` def timeConversion(s): # Write your code here
HH,MM,SS=map(int,s[:-2].split(":"))
if 'AM' in s and HH==12: HH=0
elif 'PM' in s and HH<12: HH=HH+12
return((f"{HH:02}:{MM:02}:{SS:02}")) `
0|Add CommentPermalink
vivekkishore0600 2 months ago
python solution
def timeConversion(s): # Write your code here HH,MM,SS=map(int,s[:-2].split(":"))
if 'AM' in s and HH==12:
HH=0
elif 'PM' in s and HH<12:
HH=HH+12
return((f"{HH:02}:{MM:02}:{SS:02}"))
0|Add CommentPermalink
Thihamyng 2 months ago
Python
def timeConversion(s):
# Write your code here
am = s[-2:]
time_f = s[:-2].split(':')
if am=='AM':
if time_f[0]=='12':
time_f[0]='00'
else:
if time_f[0]!='12':
time_f[0]= str(12+int(time_f[0]))
return ':'.join(time_f)
------------------
-----------------------------------------
am = s[-2:]
time_f = s[:-2].split(':')
if am=='AM':
if time_f[0]=='12':
time_f[0]='00'
else:
if time_f[0]!='12':
time_f[0]= str(12+int(time_f[0]))
return ':'.join(time_f)