Problem 3: Rectangle Area and Perimeter Class
Easypython
Problem Description
Create a class Rectangle with attributes length and width. Add two methods: area() that returns the rectangle's area, and perimeter() that returns its perimeter.
Input
Length and width of a rectangle.
Output
The calculated area and perimeter.
Constraints
- Both
lengthandwidthare positive numbers.
Example Input
textlength = 5, width = 3
Example Output
textArea: 15 Perimeter: 16
Concepts Covered
Classes, __init__, methods, return, arithmetic operations.