Challenge: User Auth
Uppgift
Swipe to start coding
Let's improve your User
class!
- Create the class attribute
is_authenticated
in theUser
class. - Define the
login()
method that takes argumentsself
andtaken_password
. - The
login()
method should compare the user and taken passwords.
If the user password is equal to the taken password, theTrue
should be assigned to theis_authenticated
attribute.
If the user password is not equal to the taken password, the"Wrong password!"
should be written in the console. - Define the
logout()
methods. This method should assign theFalse
value to theis_authenticated
instance attribute.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 8
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Awesome!
Completion rate improved to 2.78
Challenge: User Auth
Svep för att visa menyn
Uppgift
Swipe to start coding
Let's improve your User
class!
- Create the class attribute
is_authenticated
in theUser
class. - Define the
login()
method that takes argumentsself
andtaken_password
. - The
login()
method should compare the user and taken passwords.
If the user password is equal to the taken password, theTrue
should be assigned to theis_authenticated
attribute.
If the user password is not equal to the taken password, the"Wrong password!"
should be written in the console. - Define the
logout()
methods. This method should assign theFalse
value to theis_authenticated
instance attribute.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Awesome!
Completion rate improved to 2.78Avsnitt 1. Kapitel 8
single