if i enter add post! nd why does it loops 3times!! Please Explain please!! and also modify my code to make it loop once!! please
class User(): def __init__(self, fname, lname): self.name1 = fname self.name2 = lname self.user = ' ' self.user = fname + ' ' + lname def describe_user(self): print('This is ' + self.user.title() + '!') def greet_user(self): print('Hello, ', self.user.title()) class Admin(User): def __init__(self, fname, lname): super().__init__(fname, lname) def add_privileges(self, user, privileges=[ ]): print('\n') for privilege in privileges: if user == 'add post': print('You', privileges[0]) elif user == 'delete post': print('You', privileges[1]) elif user == 'ban user': print('You', privileges[2]) else: print('Error') my_code = Admin('lucky', 'nayak') my_code.describe_user() my_code.greet_user() my_code.add_privileges('add post', ['can add post', 'can delete post', 'can ban user'])