Below is 5_1 def area(x, y): ans = x*y print("Area of rectangle = %.3f"%ans) def perimeter(x, y): ans = 2*(x+y) print("\nPerimeter of rectangle = %.3f"%ans) def lenghtofdiagonal(x,y): ans = math.sqrt((x*x)+(y*y)) print("\nLenght of diagonal of rectangle = %.3f"%ans) def main(): width = float(input('Please Enter the Width of a Rectangle: ')) height = float(input('Please Enter the Height of a Rectangle: ')) area(width,height) perimeter(width,height) lenghtofdiagonal(width,height) if __name__=="__main__": main() question I need help with -This program should import program5_1 as a module. Start by making a copy of program5_1.py. Then delete the three custom functions and adjust the code to demonstrate that you understand how the dunders work in Python. Refer to pages 281-283 in the textbook.
I am writing in python.
Below is 5_1
def area(x, y):
ans = x*y
print("Area of rectangle = %.3f"%ans)
def perimeter(x, y):
ans = 2*(x+y)
print("\nPerimeter of rectangle = %.3f"%ans)
def lenghtofdiagonal(x,y):
ans = math.sqrt((x*x)+(y*y))
print("\nLenght of diagonal of rectangle = %.3f"%ans)
def main():
width = float(input('Please Enter the Width of a Rectangle: '))
height = float(input('Please Enter the Height of a Rectangle: '))
area(width,height)
perimeter(width,height)
lenghtofdiagonal(width,height)
if __name__=="__main__":
main()
question I need help with -This
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images