Question: Create a new Python script. Write a function to do each of these tasks. Also, put code in your script to call and test these
Create a new Python script. Write a function to do each of these tasks. Also, put code in your script to call and test these functions.
Functions to write:
a) A function that takes in a person's name as a parameter, and prints that name 5 times, each on its own line. Test with different names.
b) A function that takes two parameters - a person's name, and a number of times to print the name, once per line.
c) A function that takes two parameters corresponding to the a and b sides of a right triangle. Have the function print out the hypotenuse of the triangle using the Pythagorean Theorem ( you'll need the math.sqrt() function).
d) A function that takes three parameters corresponding to the a, b, and c values of a quadratic equation. Use the quadratic formula to calculate both roots for the given a, b, and c values and print them out.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
