subject
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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 21:00
Which task uses a simple parameter?
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
How do you share someone else’s tweet with your own twitter followers?
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Which of the statements below describe the guidelines for the use of text in presentation programs? a. do not use numbered lists. b. fonts should be appropriate for your audience. c. limit the number of fonts you use to three or four. d. only use bulleted lists for sales promotions. e. select font sizes that are appropriate for your delivery method. f. use font colors that work well with your background. select all that apply
Answers: 1
question
Computers and Technology, 24.06.2019 20:10
Approximately what portion of global employers tends to use social media websites to hire new employees?
Answers: 1
You know the right answer?
In Lab 03 we wrote a program to calculate the number of seconds since midnight. Modify the program b...
Questions
question
Mathematics, 02.07.2021 21:10
question
Mathematics, 02.07.2021 21:10
question
Mathematics, 02.07.2021 21:10
Questions on the website: 13722359