Create a new file called Project01- Users.py In this file create a class called User. Create two attributes called first_name and last_name. Then create any other attributes that may typically be used...



  • Create a new file called Project01- Users.py In this file create a class called User. Create two attributes called first_name and last_name. Then create any other attributes that may typically be used in a user profile.

  • Make a method called describe_user() that prints a summary of the user’s information. Make a second method called greet_user() that prints a personalized greeting to the user.

  • Create a few instances of users to ensure that everything is working

  • Now add a new attribute called login_attempts to the __init__().

  • Create 2 new methods: reset_attempts() and increment_attempts(). reset_attempts() should set the login_attempts attribute to 0. increment_attemptsa() should increase the login_attempts by 1 each time it is called. Use each method with different user instances.

  • Create a new child class called Admin. Admins should inherit from the user class. Add a new attribute called privileges. It should hold a list of strings like “can add post”, “can delete post”, “can ban user”, etc. Write a method called show_privileges() that lists the admin’s set of privileges. (use a loop)

  • Make some new instances of Admin and call inherited methods as well as the show_privileges() method.


Jun 09, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here