Question: Create a class called Rectangle with width and height (w,h) as attributes include a docstring define two methods: area and perimeter area calculates the area
- Create a class called Rectangle with width and height (w,h) as attributes
- include a docstring
- define two methods: area and perimeter
- area calculates the area of the rectangle
- perimeter calculates the perimeter of the rectangle
- include a docstring with each method
- Create a new instance of the Rectangle class with width 1 and length 4.
- Create a second instance of the Rectangle class with width 4 and length 4
- Call the method area( ) on both your first and second Rectangle object. Print the area
- Call the method perimeter( ) on your second Rectangle object and save the outcome in a new variable. Print the value of the new variable
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
