Challenge: User Auth
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 8
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
Suggested prompts:
Riassuma questo capitolo
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 2.78
Challenge: User Auth
Scorri per mostrare il menu
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 8
single