You are viewing a single comment's thread. Return to all comments →
def timeConversion(z): # Write your code here h=0 s=z[:-2] a=s.split(":") if("PM" in z): b=int(a[0]) if(b>=1 and b!=12): h=b+12 print(h,end="") else: print(a[0],end="") if("AM" in z): c=int(a[0]) if(c==12): h=0 print(0,end="") print(h,end="") else: print(a[0],end="") print(":"+a[1],end="") print(":"+a[2])
z = input() timeConversion(z)
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →
!/bin/python3
def timeConversion(z): # Write your code here h=0 s=z[:-2] a=s.split(":") if("PM" in z): b=int(a[0]) if(b>=1 and b!=12): h=b+12 print(h,end="") else: print(a[0],end="") if("AM" in z): c=int(a[0]) if(c==12): h=0 print(0,end="") print(h,end="") else: print(a[0],end="") print(":"+a[1],end="") print(":"+a[2])
z = input() timeConversion(z)