我的這個(gè)哪里錯(cuò)了,急求各位老師,謝謝
>>> xiaoming = Person('XIAOMING','boy',13)
Traceback (most recent call last):
? File "<stdin>", line 1, in <module>
TypeError: Person() takes no arguments
>>> xiaoming = Person('XIAOMING','boy',13)
Traceback (most recent call last):
? File "<stdin>", line 1, in <module>
TypeError: Person() takes no arguments
2020-09-09
舉報(bào)
2020-12-30
def __init__(self,name,age):
這樣就行了
2020-12-02
是的,竟然要兩個(gè)下劃線
2020-10-19
哈哈!樓上正解,我把練習(xí)答案復(fù)制到練習(xí)區(qū),按了兩下回刪鍵才刪掉!
2020-09-10
是不是需要兩個(gè)下劃線 __init__, 你的看起來只有一個(gè)