My code fails the 4 cade. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

My code fails the 4 cade.

Military Time You want to convert the time from a 12 hour clock to a 24 hour clock. If you are given the time on a 12 hour clock, you should output the time as it would appear on a 24 hour clock. 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. Input Format: A string that includes the time, then a space and the indicator for AM or PM. Output Format: A string that includes the time in a 24 hour format (XX:XX) Sample Input: 1:15 PM Sample Output: 13:15 https://code.sololearn.com/cYGzmQB8CKYL/?ref=app

3rd Sep 2022, 10:44 AM
Costy Game
Costy Game - avatar
1 Answer
+ 1
If hour is single digit and AM then output hour in digit by append 0; Ex: 1:00 AM => 01:00 and 12:00 AM => 00:00 12:00 PM => 12:00
3rd Sep 2022, 11:00 AM
Jayakrishna 🇮🇳