User: Make a class called User. Create two attributes called first_name and last_name, and then create several other attributes that are typically stored in a user profile. Make a method called describe_user() that prints a summary of the user's information. Make another method called greet_user() that prints a personalized greeting to the user. Then Create several instances representing different users, and call both methods for each user.
User: Make a class called User. Create two attributes called first_name and last_name,
and then create several other attributes that are typically stored in a user profile. Make
a method called describe_user() that prints a summary of the user's information. Make
another method called greet_user() that prints a personalized greeting to the user.
Then
- Create several instances representing different users, and call both methods for
each user.
Admin: write a class called Admin that inherits from the User class. Add an attribute,
privileges, that stores a list of strings like "can add post”, "can delete post”, "can ban
user”, and so on. Write a method called show_privileges() that lists the administrator's
set of privileges. Then
- Create an instance of Admin, and call your method.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps