Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: User Auth | OOP Concepts
In-Depth Python OOP

Challenge: User Auth

Task

Let's improve your User class!

  1. Create the class attribute is_authenticated in the User class.
  2. Define the login() method that takes arguments self and taken_password.
  3. The login() method should compare the user and taken passwords.
    If the user password is equal to the taken password, the True should be assigned to the is_authenticated attribute.
    If the user password is not equal to the taken password, the "Wrong password!" should be written in the console.
  4. Define the logout() methods. This method should assign the False value to the is_authenticated instance attribute.

Everything was clear?

Section 1. Chapter 8
toggle bottom row
course content

Course Content

In-Depth Python OOP

Challenge: User Auth

Task

Let's improve your User class!

  1. Create the class attribute is_authenticated in the User class.
  2. Define the login() method that takes arguments self and taken_password.
  3. The login() method should compare the user and taken passwords.
    If the user password is equal to the taken password, the True should be assigned to the is_authenticated attribute.
    If the user password is not equal to the taken password, the "Wrong password!" should be written in the console.
  4. Define the logout() methods. This method should assign the False value to the is_authenticated instance attribute.

Everything was clear?

Section 1. Chapter 8
toggle bottom row
some-alt