Skip to content
CampusEduX

Problem 3: Rectangle Area and Perimeter Class

Easypython
Learn the Concept: OOP Basics

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 length and width are positive numbers.

Example Input

text
length = 5, width = 3

Example Output

text
Area: 15 Perimeter: 16

Concepts Covered

Classes, __init__, methods, return, arithmetic operations.

Related Problems

Input (stdin)

Output

Run your code to see output here...