1. Write a program in Python that calculates the area of a rectangle. Use this formula: area = hw. Your program will have in-line documentation (a header and in-line comments). Output your answer in meters. Name your program rect_area.py
2. Write a program in Python that calculates the perimeter of a rectangle. Use this formula: perimeter = 2h + 2w. Your program will have in-line documentation (a header and in-line comments). Output your answer in meters. Name your program rect_perimeter.py
3. Write a program in Python that calculates the area of a triangle. Use this formula: area = ½bh. Your program will have in-line documentation (a header and in-line comments). Output your answer in meters. Name your program tri_area.py
4. Write a program in Python that calculates the velocity of a baseball thrown in space. Use this formula: velocity = d/t. Your program will have in-line documentation (a header and in-line comments). What unit should you use? Name your program velocity_calc.py
5. The value PI is more interesting than 3.14. Python provides support for this in a library called math. Calculate the circumference of a circle. Use this formula: circumference = 2PIr. Use the math library to help you with PI. Your program will have in-line documentation (a header and in-line comments). What unit should you use? Give your program an appropriate name.
To import the math library, try this:
import math #import the math library. THIS MUST BE AT THE TOP OF YOUR CODE.print(math.pi) #see, math.pi is a VALUE!6. Convert a temperature given in Fahrenheit to Celsius. Use this formula Celsius = 5/9 (F - 32). Your program will have in-line documentation (a header and in-line comments). What unit should you use? Give your program an appropriate name.
7. How does the round() work in Python? Go back to your first problems, and make the output more human friendly with round(). Take 1 of your solutions to the first set of problems, and implement the round function. Add '_ROUND' to the file name. You can use the round function like this:
round(3.8)# ornumber = 5.9round(number)Summative Evaluation