Time Conversion

  • + 0 comments

    def timeConversion(s): # Write your code here

    hh, mm , ss = map(int, s[:-2].split(":"))
    if s[-2:] == 'AM' and hh == 12:
        hh = 0
    elif s[-2:] == 'PM' and hh != 12:
        hh+=12
    
    return f"{hh:02}:{mm:02}:{ss:02}"
    

    if name == 'main':

    s = input()
    
    result = timeConversion(s)
    
    print(result)