Computers and Technology
Computers and Technology, 11.02.2020 23:16, akp24

In Lab 03 we wrote a program to calculate the number of seconds since midnight. Modify the program by adding error checking loops. Hour must be a number from 1 to 12. Minute and second must be numbers from 0 to 59. Also check whether "AM" or "PM" is entered. Every time an invalid value is entered, display an error message and ask the user to re-enter a valid value immediately.
The following is an example:
Enter hour: 0
Hour must be from 1 to 12.
Enter hour: 13
Hour must be from 1 to 12.
Enter hour: 12
Enter minute: -1
Minute must be from 0 to 59.
Enter minute: 60
Minute must be from 0 to 59.
Enter minute: 14
Enter second: -1
Second must be from 0 to 59.
Enter second: 60
Second must be from 0 to 59.
Enter second: 47
Enter AM or PM: FM
Please enter AM or PM
Enter AM or PM: PM
Seconds since midnight: 44087
Save your Python program in a file named Lab 04P2.py. Submit the file to Blackboard for credit.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 04:31, legendman27
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
image
Computers and Technology, 23.06.2019 05:00, mariahchaparro08
Which best explains why a digital leader would join a society specializing in technology
Answers: 1
image
Computers and Technology, 24.06.2019 02:30, cardsqueen
Which option completes the explanation for conflict of interest in an organization
Answers: 1
image
Computers and Technology, 24.06.2019 13:30, nina288
What process should be followed while giving a reference? sam has given a reference of his previous manager in his resume. sam should him in advance that the potential employers will him.
Answers: 1
Do you know the correct answer?
In Lab 03 we wrote a program to calculate the number of seconds since midnight. Modify the program b...

Questions in other subjects:

Konu
Advanced Placement (AP), 14.01.2021 18:10
Konu
History, 14.01.2021 18:10
Konu
English, 14.01.2021 18:10