見出し画像

⛰️日本の独立峰⛰️

📒script.py📒

from mountain_height import Mountainheight

mountain_height1= Mountainheight('富士山',3776)

mountain_height2 = Mountainheight('燧ヶ岳',2356)

mountain_height3 =Mountainheight('武尊山',2158)

mountain_height4 =Mountainheight('羊蹄山',1898)

mountain_height =[mountain_height1,mountain_height2,mountain_height3,mountain_height4]

for mountain_height in mountain_height:

    print(mountain_height.info())

📒mountain_height.py📒

class Mountainheight:

    def __init__(self,name,height):

        self.name = name

        self.height = height

    def info(self): 

        return self.name +':標高'

+str(self.height)+'メートル'

    


この記事が気に入ったらサポートをしてみませんか?