8.) Extend to_secs so that it can cope with real values as inputs. It should always return an integer number of seconds (truncated towards zero): def to - secs ch, m, s)i test (to_secs (2.5, 0, 10.71), 9010) test (to_secs (2.433,0,0), 8758)
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
![(7.)Write a function to_secs that converts hours, minutes and seconds to a total number of seconds.
Here are some tests that should pass:
def to_secs (h,m, s) :
haurs=h.360o
actual/Mr exPect
test(to_secs (2, 30, 10), 9010)
test(to_secs (2, 0, 0), 7200)
test(to_secs (0, 2, 0), 120)
test(to_secs (0, 0, 42), 42)
test(to_secs (0, -10, 10), -590)
mintes=m. 6
ReHrn hours+ minutes +s
8.) Extend to_secs so that it can cope with real values as inputs. It should always return an integer
number of seconds (truncated towards zero):
def to - secs ch, m,s)i
test(to_secs ( 2.5, 0, 10.71), 9010)
test(to_secs(2.433,0,0), 8758)
Write three functions that are the "inverses" of to_secs:
Opposite
1.
hpurs_in returns the whole integer number of hours represented by a total number of
Jurs-incs): econds. Th= 3b00sec (60*60=3600)
2. minutes_in returns the whole integer number of left over minutes in a total number of
ates_ins) Seconds, once the hours have been taken out.
6060 3. seconds_in returns the left over seconds represented by a total number of seconds.
(6u).
You may assume that the total number of seconds passed to these functions is an integer. He
econds-incs):
3% (6o*60)
FeltaatAinkspy/english3e/fruitful_functions.html[1/4/2012 9:37:16 PM]](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc12c6773-5a0f-42e0-aa6e-ce137efd0922%2Fc4cb7447-84c2-4138-9171-96f1bf863d95%2Fcdu6fqe_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)