Challenge: User Auth
Tehtävä
Swipe to start coding
Let's improve your User class!
- Create the class attribute
is_authenticatedin theUserclass. - Define the
login()method that takes argumentsselfandtaken_password. - The
login()method should compare the user and taken passwords.
If the user password is equal to the taken password, theTrueshould be assigned to theis_authenticatedattribute.
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 theFalsevalue to theis_authenticatedinstance attribute.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 8
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 2.78
Challenge: User Auth
Pyyhkäise näyttääksesi valikon
Tehtävä
Swipe to start coding
Let's improve your User class!
- Create the class attribute
is_authenticatedin theUserclass. - Define the
login()method that takes argumentsselfandtaken_password. - The
login()method should compare the user and taken passwords.
If the user password is equal to the taken password, theTrueshould be assigned to theis_authenticatedattribute.
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 theFalsevalue to theis_authenticatedinstance attribute.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 8
single