We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
import datetime
time = raw_input()
dtdate = datetime.datetime.strptime(time,'%I:%M:%S%p')
print dtdate.hour,":",dtdate.minute,":",dtdate.second
this is what i wrote but it says wrong error can you help me out.
fixed it, some minor problems
import datetime
time = input()
dtdate = datetime.datetime.strptime(time, '%I:%M:%S%p')
print(dtdate.strftime("%H:%M:%S"))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →
import datetime time = raw_input() dtdate = datetime.datetime.strptime(time,'%I:%M:%S%p') print dtdate.hour,":",dtdate.minute,":",dtdate.second
this is what i wrote but it says wrong error can you help me out. fixed it, some minor problems import datetime time = input() dtdate = datetime.datetime.strptime(time, '%I:%M:%S%p') print(dtdate.strftime("%H:%M:%S"))