inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

안은정님의 게시글

안은정 안은정

@alicia93

수강평 작성수
2
평균평점
5.0

게시글 2

질문&답변

Attribute Error

해당 소스코드만 돌려도 저 에러가 나타납니다..ㅠ

좋아요수
0
댓글수
4
조회수
619

질문&답변

Attribute Error

class Car () : # 괄호는 없어도 됨 # str: 사용자 입장에서 출력할때는 (비공식적인, 프린터 문으로 문자열로 출력) # repr: 객체 형태를 그대로 표시해줄때 def __init__ ( self , company , details ) : self ._company = company self ._details = details def __str__ ( self ) : # 파이썬 내부에 이미 str인스턴스가 있음 (지원해줌) return 'str : {} - {}' . format ( self ._company. self ._details ) def __repr__ ( self ) : return "repr : {} - {}" . format ( self ._company. self ._details ) car1 = Car ( 'Ferrari' , { 'color' : 'White' , 'horsepower' : 400 , 'price' : 8000 }) car2 = Car ( 'BMW' , { 'color' : 'Black' , 'horsepower' : 270 , 'price' : 5000 }) car3 = Car ( 'Audi' , { 'color' : 'Shilver' , 'horsepower' : 300 , 'price' : 6000 })

좋아요수
0
댓글수
4
조회수
619