Question: # Lab 3 starter code # CSC 110 import math def main(): print(This program is to test functions) # put your function calls here #
# Lab 3 starter code # CSC 110 import math def main(): print("This program is to test functions") # put your function calls here # This function calculates and returns the area of a trapezoid # parameter: base1, the length of the top of the trapezoid # parameter: base2, the length of the bottom # parameter: height, the height of the trapezoid # See this website for a picture http://math.com/tables/geometry/areas.htm def areaTrapezoid(base1, base2, height): area = height / 2.0 * (base1 + base2) return area main()
can anyone help this?
Functions Objectives: calling an existing function writing a function based on a specification testing your own function Part 1 t is an important skill to test functions to ensure they work correctly. In part 1, you're given a function definition that you need to test. Download this starter code. (right-click on the link and then choose: Save Link As) . Read over the function definition. Next, edit the program so that main() calls the function two times and displays results to the user. Here are the test cases base base2 height area - expected result 36 40.5 4 7 Part 2: The next skill to practice is writing your own function definition and then testing the function. In the same file, write a new function definition that is passed in the 2 legs of a right triangle, a and b, and then calculates and returns the hypoteneuse. Do not use the math.hypot () function. Your task is to implement the math yourself. Come up with 2 tests cases with the expected results calculated by hand. Test your function (call it and display the results) to confirm that the actual results of your function match the expected results Write a function block comment for your function definition that follows the same style as the comment for the areaTrapezoid() function. . NOTE: Your program should only have 1 main() function definition and only 1 call to main() at the bottom of the file. Put all the calls to areaTrapezoid() and your hypotenuse function inside main() Submit your file when you're done. Make sure to add your name to the file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
