Question: IN PYTHON LANGUAGE 4. How much time has elapsed? Unix time is commonly used to track the amount of time that has passed in computer

IN PYTHON LANGUAGE 4. How much time has elapsed? Unix time isIN PYTHON LANGUAGE

4. How much time has elapsed? Unix time is commonly used to track the amount of time that has passed in computer systems. The Unix time is stored as the number of seconds that have passed since 00:00:00 UTC January 1, 1970. However, the number of seconds by itself is not directly meaningful to most users, but luckily for us the number of seconds elapsed provides sufficient information to infer what we may need to display to an end user. Write a program, which continues to take as input a non-negative number of seconds and prints a string of the form: 'h hours, m minutes, s seconds', but where if 'h', 'm', or 's' is 1 for the number of hours, minutes, or seconds, then the singular form of the word should be used (hour, minute, or second). Note that English uses the plural when talking about 0 items, so it should be "O minutes". Once a negative time is entered, your program should exit. You can assume that the user will "play nice" and only enter integer inputs for this problem. Here is a sample run of the program: Please enter the number of seconds elapsed: 3725 1 hour, 2 minutes, 5 seconds Please enter the number of seconds elapsed: 61 O hours, 1 minute, 1 second Please enter the number of seconds elapsed: 0 O hours, 0 minutes, 0 seconds Please enter the number of seconds elapsed: -20 Exiting program... Here is reminder about a subtlety in the above problem. . In this case any negative value can be used as a "sentinel" (not just-20)

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!