반응형
Q>
사격형의 면적과 둘레 길이를 구하는 클래스를 작성하시오.
A>
class Square:
width = 0
height = 0
def __init__(self, width, height):
self.width = width
self.height = height
def getArea(self):
return self.width * self.height
def getRound(self):
return self.width * 2 + self.height * 2
O>
Process finished with exit code 0
반응형
'Python_Matter > Solve' 카테고리의 다른 글
Python Learn the basics Quiz 29 (0) | 2019.04.30 |
---|---|
Python Learn the basics Quiz 28 (0) | 2019.04.26 |
Python Learn the basics Quiz 26 (0) | 2019.04.13 |
Python Learn the basics Quiz 25 (0) | 2019.04.13 |
Python Learn the basics Quiz 24 (0) | 2019.04.13 |