|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 行道在心 于 2019-9-22 20:23 编辑
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()
my_new_car = Car('audi', 'a4', 2016)
print(my_new_car.get_descriptive_name())
Traceback (most recent call last):
File "car.py", line 13, in <module>
my_new_car = Car('audi', 'a4', 2016)
TypeError: Car() takes no arguments
请问是哪出错了
------------------
(program exited with code: 1)
按下 Shift,连续打两次减号(0 旁边的按钮)
|
|