六级参考课程仅供参考第六课.pptxVIP

  • 2
  • 0
  • 约小于1千字
  • 约 14页
  • 2021-11-06 发布于北京
  • 举报
;;;;一次模拟小狗的尝试;;;一次模拟汽车的尝试;class ElectricCar(Car): 电动汽车的独特之处 def __init__(self,make,model,year): 初始化父类属性 super().__init__(make,model,year) 初始化电动车特有的属性 self.battery_size = 70 def describe_battery(self): 打印一条电瓶车容量的消息 print(This car has a + str(self.battery_size) + -kwh battery) my_tesla = ElectricCar(tesla,model s,2016) print(my_tesla.get_descriptive_name()) my_tesla.describe_battery();;;导入模块的几种方式;模块相关其他用法;

文档评论(0)

1亿VIP精品文档

相关文档