Home / Challenges / Rectangle Class

Rectangle Class

Easy
Create a class Rectangle with attributes width and height, set in __init__. Add methods area() returning width*height, and perimeter() returning 2*(width+height).

Input

Two numbers: width and height.

Output

The area and perimeter as numbers.

Example

Input
Rectangle(4, 5)
Output
Area: 20
Perimeter: 18
10 XP on solve Back to lesson

Your Solution

Output
Click "Run" to execute your code...

Log in to submit your solution and earn XP.