4/18 Please help


#1

class ThisISClass(object):
def init(self,name):
self.classvar = 1
self.name = name
def class_method(self, name, work_var):
return self.classvar * work_var

a_class = ThisISClass()
print(a_class.class_method(6))


#2
class ThisISClass(object):
    def init(self,name):
        self.classvar = 1
        self.name = name
    def class_method(self, name, work_var):
        return self.classvar * work_var

a_class = ThisISClass()
print(a_class.class_method(6))

You didn't pass initial parameters when setting a_class (you need a name). Also, you don't need to pass name to class_method, because you don't use it.


#3

I still don't get it


#4

In your init method, you set one param, name (forgot self for now). That means that, when creating an instance of that class, you need to pass a value (an int, a str, whatever) that will be the instance's name property.


#5

Does anyone have the code?


#6

I passed 4/18 with this:

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


#8

What is the full code? I am having problems too so it would be nice to compare


#9

This is the correct code:
class Animal(object):
def init(self, name):
self.name = name


#10

This still is not working for me.


#11

my code

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


#12

You need indentations. Also it's: def init()
You need to underscores