Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Having trouble with this program. My major issue is how to do the checks for numeric values in the user's input. Write a python program

Having trouble with this program. My major issue is how to do the checks for numeric values in the user's input.

Write a python program to do the following. Ask user to enter time in the format of hh:mm:ss. For example, 11:07:28. Hour must be a two-digit number between 00 and 23, inclusive. Minute and second must be two-digit numbers between 00 and 59, inclusive. The program needs to check whether the time entered is valid.

Check whether there are exactly two colons. Display an error message and stop if the input is invalid.

Check whether hour is a two-digit number. Display an error message and stop if the input is invalid.

Check whether minute is a two-digit number. Display an error message and stop if the input is invalid.

Check whether second is a two-digit number. Display an error message and stop if the input is invalid.

Check whether hour is between 0 and 23, inclusive. Display an error message and stop if the input is invalid.

Check whether minute is between 0 and 59, inclusive. Display an error message and stop if the input is invalid.

Check whether second is between 0 and 59, inclusive. Display an error message and stop if the input is invalid.

If the time entered is valid, remove the colons and display the time. For example, if the input time is 11:07:28, the program should display 110728.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

4. The bank statement showed interest earned of $75.

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago