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

Kursinhalt

In-Depth Python OOP

In-Depth Python OOP

1. OOP Concepts
2. Inheritance
3. Encapsulation
4. Polymorphism and Abstraction
5. Magic Methods

book
Challenge: User Auth

Aufgabe

Swipe to start coding

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.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 8
toggle bottom row

book
Challenge: User Auth

Aufgabe

Swipe to start coding

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.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 8
Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
We're sorry to hear that something went wrong. What happened?
some-alt