Beginner question about class

I’m following a tutorial and am learning about creating a class in Python. I’ve double-checked my code against the tutorial and I don’t see any errors, but I’m getting
TypeError: User() takes no arguments. If you can point out what I’m doing wrong, I would be most grateful. This was how the person demonstrating passed parameters to create a new object from class User, but it’s not working the same way for me. Thank you!

class User:
    def __int__(self, user_email, name, password, current_job_title):
        self.email = user_email
        self.name = name
        self.password = password
        self.current_job_title = current_job_title

    def change_password(self, new_password):
        self.password = new_password

    def change_job_title(self, new_job_title):
        self.current_job_title = new_job_title

    def get_user_info(self):
        print(f"User {self.name} currently works as a {self.current_job_title}.  You can contact them at {self.email}.")

app_user_one = User("email@email.com", "John Smith", "passw0rd", "Engineer")
app_user_one.get_user_info()

You spelled “__init__” wrong :wink:

:face_with_open_eyes_and_hand_over_mouth: How embarrassing. An hour of staring at this and I couldn’t see that.

Thank you

It happens :wink:
But now you know that the error refers to the __init__ method and in this case because of the spelling error, it used the default one, which is empty.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.