alicia93
@alicia93
Reviews Written
2
Average Rating
5.0
Posts
Q&A
Attribute Error
ํด๋น ์์ค์ฝ๋๋ง ๋๋ ค๋ ์ ์๋ฌ๊ฐ ๋ํ๋ฉ๋๋ค..ใ
- 0
- 4
- 572
Q&A
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
- 572




