0
Why is not working?
https://code.sololearn.com/cc1yDjjIx66H/?ref=app Is the military time task. Task: Determine if the time you are given is AM or PM, then convert that value to the way that it would appear on a 24 hour clock.
4 Respuestas
+ 3
12:00 PM is 12:00
12:00 AM is 00:00
An easy way of doing this is:
hour%12 (+12 if PM)
Also, try using the split method, it will result in a much cleaner solution
And there is no need to str() input(), it's already a string
Good job for using f-strings :D
0
What is the split method?
0
Thank you by the way :) it works
0
MasterTom18
"15:30 PM".split() -> ["15:30", "PM"]
"15:30".split(":") -> ["15", "30"]