Time Conversion

  • + 0 comments
    def timeConversion(s):
        # Write your code here
        if s[-2] == "P" and s[0:2] != "12":
            o = int(s[0:2])+ 12
            return f"{str(o)}:{s[3:8]}"
        elif  s[-2] == "A" and s[:2] == "12":
            return f"00:{s[3:8]}"
        else:
            return s[:-2]