Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started