Why is the interpreter showing on line 8

I am making a program using classes. The source code is below:


When I am executing the code I am getting the error
Exception has occurred: NameError name 'self' is not defined File "*******************", line 8, in <module> password_manager.input_r(self)
Even if I write password_generator.input_r(), it shows an error.

I will be thankful I anyone helps me in resolving the error.
THANK YOU

Because you call the input_ method directly on the class (not an instance), you need to provide a class instance. Or you need to instantiate your class, which i would recommend

i would also recommend pep8 standards for naming your class, so it should be PasswordManager

2 Likes