Home > other >  Python is a small white for help!!!!!!
Python is a small white for help!!!!!!

Time:11-24

Python is a small white for advice!
In his writing a program, the error didn't know how to modify:
The class Dog (object) :

Typee='pets' # class variables/attribute

Def __init__ (self, name, age, color) : # self said that the current object
Self. Name=# name instance variable/attribute
The self. The age=age
The self. The color=color

The class Dogg (Dog) :
Def __init__ (self, height, color) :
Super (Dogg, self) __init__ (color) # call initialization method of the parent
The self. The height=height

Dogg=dogg (' 180 cm ', 'black')

Run according to

Traceback (the most recent call last) :
The File "/Users/oliverhan/Desktop/Python exercises/the dog's behavior. Py", line 49, in & lt; module>
Dogg=dogg (' 180 cm ', 'black')
The File "/Users/oliverhan/Desktop/Python exercises/the dog's behavior. Py", line 33, in __init__
Super (Dogg, self) __init__ (color) # call initialization method of the parent
TypeError: __init__ () the missing 2 required positional arguments: 'age' and 'color'

CodePudding user response:


Without a parent parameters, it is ok to catch up on

CodePudding user response:

 import pandas as pd 

The class Dog (object) :

Typee='pets' # class variables/attribute

Def __init__ (self, name, age, color) : # self said that the current object
Self. Name=# name instance variable/attribute
The self. The age=age
The self. The color=color

The class Dogg (Dog) :
Def __init__ (self, name, age, height, color) :
Super (Dogg, self) __init__ (name, age, color) # call initialization method of the parent
The self. The height=height

Dogg=dogg (' name ', 'age', '180 cm', 'black')

  • Related