Answers for "calculate perimeter of rectangle in a class in python"

0

calculate perimeter of rectangle in a class in python

class Rectangle:
    def __init__(self, width, length):
        self.length = length
        self.width = width
        
    
    def calculate_perimeter(self):
        
        return 2 * (self.width + self.length)
    
Rectangle_1 = Rectangle(3, 4)

print (Rectangle_1.calculate_perimeter())
Posted by: Guest on October-26-2020

Code answers related to "calculate perimeter of rectangle in a class in python"

Python Answers by Framework

Browse Popular Code Answers by Language