Challenge: User Auth
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 8
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Summarize this chapter
Explain the code in file
Explain why file doesn't solve the task
Awesome!
Completion rate improved to 2.78
Challenge: User Auth
Swipe to show menu
Task
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.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 8
single