Skip to content

Instantly share code, notes, and snippets.

@shlaikov
Created January 24, 2018 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shlaikov/24e9c74337281e7b23b3c22d08973b4e to your computer and use it in GitHub Desktop.
Save shlaikov/24e9c74337281e7b23b3c22d08973b4e to your computer and use it in GitHub Desktop.
def chg_val(l):
s = ''
list_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'
}
list_am = {
'00': '12',
'01': '01',
'02': '02',
'03': '03',
'04': '04',
'05': '05',
'06': '06',
'07': '07',
'08': '08',
'09': '09',
'10': '10',
'11': '11',
'12': '00',
}
string = l[2]
if (string[2:4] == 'PM'):
s = str(list_pm.get(l[0])) + ':' + l[1] + ':' + string[0:2]
elif (string[2:4] == 'AM'):
s = str(list_am.get(l[0])) + ':' + l[1] + ':' + string[0:2]
return s
time = input().strip().split(':')
p = chg_val(time)
print(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment