Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The le problem3.py contains a single function named getSeconds(). This function takes exactly one argument: an 8-character string representing an amount of time in the

The le problem3.py contains a single function named getSeconds(). This function takes exactly one argument: an 8-character string representing an amount of time in the form HH:MM:SS, where HH represents a number of hours, MM represents a number of minutes, and SS represents a number of seconds. getSeconds() returns a positive integer representing the total number of seconds in the input. For example, the time value "02:18:49" (2 hours, 18 minutes, and 49 seconds) corresponds to a total of 8329 seconds: there are 3600 seconds in an hour and 60 seconds in a minute, so we have (2 * 3600) + (18 * 60) + 49, which adds up to 8329. You may assume that the number of hours always falls in the range 00-99 (inclusive), the number of minutes always falls in the range 00-59 (inclusive), and the number of seconds always falls in the range 00-59 (inclusive). HINT: Use string slicing to extract each of the three time elds (hours, minutes, and seconds) from the function parameter. Each slice is still a string, so you will need to convert it to an integer before you can perform any arithmetic with it (in class, we discussed a function for doing this).

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

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions

Question

Understand cultural differences.

Answered: 1 week ago

Question

design a simple performance appraisal system

Answered: 1 week ago