Question: Write a program called 'time.py ' for checking the validity of a time entered by the user as a set of three integers. In professional

Write a program called 'time.py' for checking the validity of a time entered by the user as a set of three integers. In professional software, it is never assumed that input from users is valid so you too need to do this in your programs.In this case, you want to check if the number of hours is between 0 and 23(inclusive), the number of minutes is between 0 and 59(inclusive) and the number of seconds is between 0 and 59(inclusive).
Sample I/O (The input from the user is shown in bold font): Enter the hours:21 Enter the minutes:7 Enter the seconds:7 Your time is valid.Sample I/O (The input from the user is shown in bold font): Enter the hours:25 Enter the minutes:-7 Enter the seconds:0 Your time is invalid.
Sample I/O (The input from the user is shoWn in bold font):
Enter the hours:
21
Enter the minutes:
7
Enter the seconds:
72
Your time is invalid.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!