4/18 Please help

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))

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.

I still don’t get it

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.

Does anyone have the code?

I passed 4/18 with this:

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

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

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

1 Like

This still is not working for me.

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

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