PROGRAM TO CONVERT 12HOURS CLOCK TIME INTO 24HOURS CLOCK
def timeConversion(s):
if s[0:2] == "12" and s[-2:] == "AM":
print("00"+s[2:8])
elif s == "12:00:00AM":
print("00:00:00")
elif s[0:2] == "12" and s[7:9] == "PM":
print(s[0:7])
elif s[-2:] == "PM" and s[0:2] != "12":
print(f"{int(s[:2])+12}{s[2:8]}")
elif s[0:2] == "24":
print("THIS TIME IS ALREADY AS 24 HOURS CLOCK")
else:
print(s[0:8])
# convert 12 hours to 24 hours
# Write your code here.
#
if __name__ == '__main__':
s = input()
timeConversion(s)
Nice
ReplyDeletethanks a lot for you nice comment
Delete