一个关于中华人民共和国的小程序
class China:def __init__(self, cover, population):
self.cover = cover
self.population = population
print(f"\tChina has about {self.cover} covers.")
print(f"China has about {self.population} populations.")
def moutains(self):
print("\tChina has a lot of moutains.")
def famous_moutain(self):
print("Mount Huang is famous.")
def rivers(self):
print("\tChina has a lot of rivers, too.")
def famous_river(self):
print("And Huanghe river, Yangze river is famous, too.")
def love_China(self):
print("\tI love China!")
the_China = China(9600000, 1400000000)
the_China.moutains()
the_China.famous_moutain()
the_China.rivers()
the_China.famous_river()
the_China.love_China()
这是我无聊时写的一个小程序,欢迎大家点评(运行时无错误)!比如可以简化一些部分吗?
[此贴子已经被作者于2023-10-1 22:50编辑过]