Compare commits

..

No commits in common. "766472d311bee2f873bb9f6dc3bac8e9367c0d77" and "1ec18268150f563e96bc0b73ce29195becb4793b" have entirely different histories.

4 changed files with 0 additions and 60 deletions

View File

@ -38,7 +38,6 @@ class Privileges:
if self.privileges:
for privilege in self.privileges:
print(f" - {privilege}")
break
else:
print(" - This user has no privileges.")

View File

@ -1,12 +0,0 @@
# Exercise 9-12 Multiple Modules
# Learning Objective: Use multiple modules in one program.
from admin import Privileges, Admin
frank = Admin("Frank", "Enbeens", "06/24/63", "WY", "Green")
frank.privileges.privileges = ["full administrative access", "can change other user's privileges"]
frank.describe_user()
frank.privileges.show_privileges()

View File

@ -1,22 +0,0 @@
from user import Users
class Privileges:
def __init__(self, privileges=[]):
"""Create separate class for privileges """
self.privileges = privileges
def show_privileges(self):
""" Print Privileges list """
print(f"This user has the following privileges:\n")
if self.privileges:
for privilege in self.privileges:
print(f" - {privilege}")
break
else:
print(" - This user has no privileges.")
class Admin(Users):
def __init__(self, first_name, last_name, dob, state, hair_color):
""" Initialize Users the add sepeicifc Admin attributes/methods """
super().__init__(first_name, last_name, dob, state, hair_color)
self.privileges = Privileges()

View File

@ -1,25 +0,0 @@
class Users:
def __init__(self, first_name, last_name, dob, state, hair_color):
"""Initialize User Profile variables"""
self.first_name = first_name
self.last_name = last_name
self.dob = dob
self.state = state
self.hair_color = hair_color
self.login_attempts = 0
def describe_user(self):
"""Prints descriptions of user based on inputs"""
print(f"{self.first_name} {self.last_name} was born on {self.dob}, they live in {self.state} and they have {self.hair_color} hair")
def greet_user(self):
"""Prints personalized greeting to user specified"""
print(f"Welcome to this python program, {self.first_name} {self.last_name}!")
def increment_login_attempts(self):
"""Increments Login Attempts by one"""
self.login_attempts += 1
def reset_login_attempts(self):
"""Resets login attempts to zero"""
self.login_attempts = 0