클래스 썸네일형 리스트형 파이썬 생성자, 상속 문제 풀기 생성자 문제 class Cake: def __init__(self, fruit, snack, price): self.fruit = fruit self.snack = snack self.price = price self.sales = 0 def sell(self): self.sales += self.price print("이 케익의 가격은 {}원입니다.".format(self.price)) def income(self): print("케익은 총 {}원 팔았습니다.".format(self.sales)) a = Cake("수박", "핫도그", 10000) a.sell() a.sell() a.sell() a.sell() a.sell() a.sell() a.income() 상속 문제 #클래스 상속 #상속을 하려고.. 더보기 이전 1 다음