Time Conversion

  • + 0 comments

    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}"))