Time Conversion

  • + 0 comments

    My Solution to that Problem:

    def timeConversion(s): # Write your code here PM = { "01": "13", "02": "14","03": "15",
    "04": "16", "05": "17", "06":"18", "07": "19", "08":"20", "09": "21", "10":"22", "11": "23", "12":"12"}

    if s[-2] == "P":
        return PM[s[0:2]]+s[2:8] 
    
    if s[-2] == "A" and s[0:2] == "12":
        return "00"+s[2:8]  
    else:
        return s[0:8]