Why am I getting this error in python in OOP?

Viewed 13
class Monster:
#class attribute
color='black'

    def __int__(self,age,name):
        #instance attributes
        self.age=age
        self.name=name

        self._is_innocent=None

    #instance method
    def steal(self,warrior):
        warrior.lose_stick()

#creating   an instance
monster1=Monster(15,'mon1')
    
#accesing attributes
print(monster1.age)
    
#changing attribute value
monster1.age=10
    
#creating another instance
monster2=Monster(10,'mon2')

when I run this code I get an TypeError in python

Traceback (most recent call last): File "C:\Users\issur\PycharmProjects\pythonProject\Pycharm\Test.py", line 17, in monster1=Monster(15,'mon1') TypeError: Monster() takes no arguments

0 Answers
Related