Question: Write a Python function that converts a clock reading from 24h system to 12h system. For example, 14 becomes 2, 23 becomes 11 and so

Write a Python function that converts a clock reading from 24h system to 12h system. For example, 14 becomes 2, 23 becomes 11 and so on. Don't hardcode if else block for each case. This is only allowed for edge cases or special exceptions. When running the code, the function should display the following message: Welcome to Comp 208 time converter. Please enter the time to convert (hours only without minutes): Then, when the user inputs a number, the function should verify whether the provided number is a valid number, meaning it is a positive number between 0 and 23. If not, you should display an error message telling the user that The number is invalid". If the number is valid you should display the following message (assuming the user inputs 13): You have entered 13 in 24h mode. The equivalent in 12h mode is: 01 Or also, assuming the user inputs 12: You have entered 12 in 24h mode. The equivalent in 12h mode is: 12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
