# ์ด 3๋์ ๋งค๋ฌผ์ด ์์ต๋๋ค.
# ๊ฐ๋จ ์ํํธ ๋งค๋งค 10์ต 2010๋
# ๋งํฌ ์คํผ์คํ
์ ์ธ 5์ต 2007๋
# ์กํ ๋น๋ผ ์์ธ 500/50 2000๋
#
class House:
#๋งค๋ฌผ ์ด๊ธฐํ
def __init__(self, location, housetype, deal_type, price, completion_year):
self.location = location
self.housetype = housetype
self.deal_type = deal_type
self.price = price
self.completion_year = completion_year
def show_detail(self):
print(self.location, self.housetype, self.deal_type\
,self.price, self.completion_year)
houses = []
house1 = House("๊ฐ๋จ", "์ํํธ", "๋งค๋งค", "10์ต", "2010๋
")
house2 = House("๋งํฌ", "์คํผ์คํ
" , "์ ์ธ", "5์ต", "2007๋
")
house3 = House("์กํ", "๋น๋ผ" , "์์ธ", "500/50", "2000๋
")
houses.append(house1)
houses.append(house2)
houses.append(house3)
print("์ด {0}๋์ ๋งค๋ฌผ์ด ์์ต๋๋ค.".format(len(houses)))
for house in houses:
house.show_detail()
print("")
'Coding > Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[python] ์์ธ์ฒ๋ฆฌ ํด์ฆ (0) | 2021.11.04 |
---|---|
[python] ์์ธ ์ฒ๋ฆฌ (0) | 2021.11.04 |
[python] ํ์ด์ฌ์ผ๋ก ๋ง๋ ์คํํฌ๋ํํธ (0) | 2021.11.03 |
[python] ํด๋์ค(pass, super) (0) | 2021.11.03 |
[python] ํด๋์ค(๋ฉ์๋ ์ค๋ฒ๋ผ์ด๋ฉ) (0) | 2021.11.03 |