- 1
Write a program to convert the time format from 12 hours to 24 hours.
Write a Python program that will ask the user to input the time & will add one space after that (*like 1:15 PM*). And will convert the time fromm 12 hour format to 24 hour format. For example: Input: 1:15 PM Output: 13:15
2 Respuestas
+ 5
Hello, Ashutosh Pattnaik
Show us your attempts! These questions are made for practice! Try it yourself, hints are also available at code coaches!
+ 1
Ashutosh Pattnaik
Using % with a bit of thought can help you with this problem.
Break it down into smaller projects.
You have a string input =>
1:15 PM, but you need to break it into pieces & turn some of those pieces into integers.
hrs
mins
am_pm
If you are going to use math on hrs, then it needs to be an integer.
if it is am or pm, then different math must apply.
Remember => string output xx:xx
Good luck.