-
카테고리
-
세부 분야
프로그래밍 언어
-
해결 여부
미해결
오류
21.03.06 22:53 작성 조회수 189
0
class House:
# 매물 초기화
def __init__(self, location, house_type, price, completion_year):
self.location = location
self.house_type = house_type
self.deal_type = deal_type
self.price = price
self.completion_year = completion_year
# 매물 정보 표시
def show_detail(self):
print(self.location, self.house_type, self.deal_type\
, self.price, self.completion_year)
houses = []
house1 = House("강남", "아파트", "매매", "10억", "2010년")
house2 = House("마포", "오피스텔", "전세", "5억", "2007년")
house3 = House("송파", "빌라", "월세", "500/50", "2000년")
안녕하세요!
house1 = House("강남", "아파트", "매매", "10억", "2010년")
이 부분에서 TypeError: __init__() takes 5 positional arguments but 6 were given
오류가 계속 뜨는데요
5개씩 짝이 맞지 않나용..??ㅠㅠ 왜 오류가 뜨는걸까요?!
답변을 작성해보세요.
1
PARK JUNYEONG
2021.03.07
매물 초기화 부분에서 deal_type 부분이 빠져서 오류가 뜨는거에요~~
def __init__(self, location, house_type, price, completion_year):
def __init__(self, location, house_type, deal_type, price, completion_year):
또한, 매물 정보 표시 부분에 아래 코드 부분을
# 매물 정보 표시
def show_detail(self):
print(self.location, self.house_type, self.deal_type\
, self.price, self.completion_year)
이렇게 변경해주세요~
# 매물 정보 표시
def show_detail(self):
print(self.location, self.house_type, self.deal_type, self.price, self.completion_year)
매물 초기화 부분과 매물 정보 표시 부분을 살짝 수정하면 오류는 잡힐거에요~~
------------------------------------------------------------
도움이 되었으면 우측하단 또는 좌측하단에 하트 한번만 눌러주세요 :)
또한, 해결이 안된 경우 답글 작성 부탁드립니다!
답변 1