Explanation of classes code


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
Please what is the meaning of def init(self).
what is the self doing?

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>

```python

Replace this line with your code.

<do not remove the three backticks above>

#2

A post was split to a new topic: Not sure what went wrong


#4

self if the equivalent of this in JavaScript. It is the context object that references the current instance.

class Foo(object):
    def __init__(self, name):
        self.name = name
    def __repr__(self):
        return self.name

foo = Foo('foo')

print (foo)   # -> foo

#5

thanks for the explanation.


#7