Class error

Hi
when I try to run this code he keeps showing me this error

(Traceback (most recent call last):
File “main.py”, line 8, in
player1 = PlayerCharacter(‘ali’)
TypeError: PlayerCharacter() takes no arguments)

where is the error please?

class PlayerCharacter :
    def  __int__(self, name):
        self.name=name

    def run(self):
        print('run')

player1 = PlayerCharacter('ali')

print(player1.name)

your class doesn’t have an __init__ method. You made a typo, you have int, should be init (short for initialize)

2 Likes

thank you , typing error …