标签:car color new bat electric beetl code python script
cat my_car.py
1 #! /usr/bin/python 2 # -*- coding:utf-8 -*- 3 4 5 from car import Car 6 from electric_car import ElectricCar 7 # Car类逻辑测试 8 my_new_car = Car(‘volkswagen‘, ‘beetle‘, 2017) 9 print my_new_car.get_descriptive_name() 10 my_new_car.read_odometer() 11 my_new_car.update_odometer(30) 12 my_new_car.read_odometer() 13 my_new_car.increment_odometer(20) 14 my_new_car.read_odometer() 15 16 print ‘-‘*10 17 18 # 实例用作属性测试 19 my_tesla = ElectricCar(‘tesla‘, ‘model s‘, 2016) 20 print my_tesla.get_descriptive_name() 21 my_tesla.battery.describe_battery() 22 my_tesla.battery.get_range() 23 my_tesla.full_gas_tank()
标签:car color new bat electric beetl code python script
原文地址:https://www.cnblogs.com/leejay/p/14409733.html