1 Star 0 Fork 0

Python程序设计/jinyifei20192309

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
车类.py 559 Bytes
一键复制 编辑 原始数据 按行查看 历史
yifei 提交于 2020-04-08 21:32 +08:00 . sixth
class Car():
def __init__(self,make,model,year):
self.make = make
self.model = model
self.year = year
def get_descriptive_name(self):
long_name = str(self.year) + ' ' + self.make + ' ' + self.model
return long_name.title()
class Electriccar(Car):
def __init__(self,make,model,year):
super().__init__(make,model,year)
self.menu = ['a','b','c','d']
my_new_car = Car('audi','a4',2016)
print(my_new_car.get_descriptive_name())
my_tesla = Electriccar('tesla','d5',2019)
for object in my_tesla.menu:
print(object)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/python_programming/jinyifei20192309.git
git@gitee.com:python_programming/jinyifei20192309.git
python_programming
jinyifei20192309
jinyifei20192309
master

搜索帮助