I keep getting this error on the last line of my code when I am trying to call a function from another class inside of my original class.
class User:
def __init__(self, first_name, last_name, age, gender):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.gender = gender
self.login_attempts = 0
def describe_user(self):
user_info = f'{self.first_name} {self.last_name} is {self.age} years old and {self.gender}'
print(user_info)
def greet_user(self):
greeting = f'Hello {self.first_name} {self.last_name}, glad you signed up for our program'
print(greeting)
def increment_login_attempts(self):
self.login_attempts += 1
def reset_login_attempts(self):
self.login_attempts = 0
class Admin(User):
def __init__(self, first_name, last_name, age, gender):
super().__init__(first_name, last_name, age, gender)
self.privileges = Privileges
class Privileges:
def __init__(self, privileges = ('can add post', 'can delete post', 'can ban user')):
self.privileges = privileges
def show_priviliges(self):
print('If you are an admin you can do the following: ')
for privilege in self.privileges:
print(f'- {privilege}')
admin_1 = Admin('Kyle', 'Resetar', 14, 'male')
admin_1.privileges.show_priviliges()
I did not think I had to fill .show_privileges() with a parameter and I am lost. Any solutions?
self.privileges = Privileges, what exactly do you expect this to do? - Karl Knechtel