📜  在python代码示例中计算类中矩形的周长

📅  最后修改于: 2022-03-11 14:45:45.118000             🧑  作者: Mango

代码示例1
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())