0

PLEASE HELP ME RESOLVE THIS ERROR

class User: def ___init___(self, user_id, username): self.id = user_id self.username = username self.followers = 0 self.following = 0 def follow(self, user): self.following += 1 user.followers += 1 user_1 = User("007", "gift") user_2 = User("004", "Abrams") user_1.follow(user_2) print(user_1.following) print(user_1.followers) print(user_2.followers) print(user_2.following) #TypeError: User() takes no arguments

20th Jul 2022, 6:55 AM
Gift Claire
Gift Claire - avatar
3 Respuestas
+ 3
Gift Claire You have 3 underscores on either side of your init. Reducing it to 2 each side makes your code work. ___init___ -> incorrect __init__ -> correct
20th Jul 2022, 7:15 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Ohh thank you. It has worked
20th Jul 2022, 8:26 AM
Gift Claire
Gift Claire - avatar
+ 2
Rik Wittkopp 👀 like an eagle 👏👏
20th Jul 2022, 5:01 PM
Oma Falk
Oma Falk - avatar