Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Abhayparashar31/c06a73b953550565f096a6a974700814 to your computer and use it in GitHub Desktop.
Save Abhayparashar31/c06a73b953550565f096a6a974700814 to your computer and use it in GitHub Desktop.
data = input()
if data[-2:]=='PM' and int(data[:2])!=12:
hour = data[:2]
hour=int(hour)+12
less = data[2:-2]
datas=str(hour)+less
print(datas)
elif data[-2:]=='AM' and int(data[:2])!=12:
print(data[0:-2])
elif data[-2:]=='AM' and data[:2]=='12':
temp='00'
datas=temp+data[2:-2]
print(datas)
elif data[-2:]=='PM' and int(data[:2])==12:
print(data[:-2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment