Why is not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

6th Aug 2021, 4:11 PM
MasterTom18
MasterTom18 - avatar
4 Answers
+ 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
6th Aug 2021, 4:31 PM
Angelo
Angelo - avatar
0
What is the split method?
6th Aug 2021, 5:36 PM
MasterTom18
MasterTom18 - avatar
0
Thank you by the way :) it works
6th Aug 2021, 5:42 PM
MasterTom18
MasterTom18 - avatar
0
MasterTom18 "15:30 PM".split() -> ["15:30", "PM"] "15:30".split(":") -> ["15", "30"]
6th Aug 2021, 5:55 PM
Angelo
Angelo - avatar