"let's not get to selfish" Please help


#1

class Animal(object):
pass


#2

class Animal(object):
def init(name):
self.name = name
pass

Need Help!


#3

class Animal(object):
    def __init__(self,name):
        self.name = name

#4

even with indentation i don't get the output.
class Animal(object):
def init(self,name):
self.name = name

my_animal=Animal()
this is what shown in the console
File "python", line 7, in
TypeError: init() takes exactly 2 arguments (1 given)

please help friends


#5

Rename your init() method to __init__(), that's special method to initialize instance of your class.

Your __init__() method takes name as argument. You forgot to pass name of animal in parentheses.

my_animal = Animal("John")

#6

thnk you I've rectified it


#7