#saying it takes 3 positional arguments where 4 given

12 messages · Page 1 of 1 (latest)

ember wadiBOT
#
Code Formatting

When sharing code with the community, please use the correct formatting for ease of readability.

Example

```py
YOUR CODE HERE
```

Those are back ticks not single quotes, typically the key above TAB

willow blade
#
game_1 = Game(2025, 'Grand Theft Auto VI', 'London')
daring pewter
#

Show the full error message

willow blade
#

the code for my class is:

#
class Game:
    def __init__(year, name, city):
        self.year = year
        self.name = name 
        self.city = city


    def __repr__(self):
        return "game('{}', '{}', '{}')".format(self.year, self.name, self.city)
daring pewter
#

You're missing the self arg on the __init__ function

willow blade
#

wdym?

daring pewter
#

You see __repr__? It has a self. You need that as the first arg to __init__ as well. It's required for functions in a class.

rain hearth
#

def __init__ (self, year, name, city): is how it should be

willow blade
#

ohhhh thank you sm

#

les go my code be working