MCPcopy Create free account
hub / github.com/ZiniuLu/Python-100-Days / Rect

Class Rect

Day01-15/Day09/shape.py:45–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44
45class Rect(Shape):
46
47 def __init__(self, width, height):
48 self._width = width
49 self._height = height
50
51 def perimeter(self):
52 return 2 * (self._width + self._height)
53
54 def area(self):
55 return self._width * self._height
56
57 def __str__(self):
58 return '我是一个矩形'
59
60
61if __name__ == '__main__':

Callers 1

shape.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected