OOP 7: Adding Parameters

OOP 7: Adding Parameters

7.1.在Car 类的__init__ 方法中添加fuel_used 属性,但不改变其参数,并将其赋值为0 升。

7.2.在Car 类的__init__ 方法中添加fuel_consumption 属性,将其作为方法参数传递,默认值为7 (升/100 公里)。

7.3.在Car 类中添加一个drive 方法,该方法的参数类型为distance int(公里)的参数。如果类的实例已启动 - 用适当的值递增fuel_used ,并显示信息"Currently driven {distance}...

You should be an authorized user in order to see the full description and start solving this mission.