python问题?第二个类定义了privileges_list属性,为什么还会报错?

python问题?第二个类定义了privileges_list属性,为什么还会报错?
问题相关代码,请勿粘贴截图
class User:
    def __init__(self,first_name,last_name,login_attempts):
        self.first_name = first_name
        self.last_name = last_name
        self.login_attempts = login_attempts
    def describe_user(self):
        name = self.first_name+self.last_name
        print(name)
    def greet_user(self):
        print('Hello',self.first_name,'.',self.last_name)
    def increment_login_attempts(self):
        for i in range(1,10,2):
            self.login_attempts =int(self.login_attempts) +i
            print(self.login_attempts)
    def reset_login_attempts(self):
        self.login_attempts =0
        print(f"重置后:{self.login_attempts}")
class Privileges:
    def _init_(self,privileges_list = ['can add post','can delete post','can ban user']):
        self.privileges_list = privileges_list
    def show_privileges(self):
        print(f"your privileges as follows:{self.privileges_list}.")

class Admin(User):
    def __init__(self,first_name,last_name,login_attempts):
        super().__init__(first_name,last_name,login_attempts)
        self.privileges = Privileges()  # 将实例用作属性

user = Admin(first_name='zhang',last_name='samsam',login_attempts=10)
user.describe_user()
user.greet_user()
user.privileges.show_privileges()#user先调用Admin中priviles属性再调用show_privieges方法
user.increment_login_attempts()
user.reset_login_attempts()
运行结果及报错内容

D:\Anacoda\pythonw.exe D:/pycharm/pythonProject/main.py
zhangsamsam
Hello zhang . samsam
Traceback (most recent call last):
File "D:/pycharm/pythonProject/main.py", line 32, in
user.privileges.show_privileges()#user先调用Admin中priviles属性再调用show_privieges方法
File "D:/pycharm/pythonProject/main.py", line 22, in show_privileges
print(f"your privileges as follows:{self.privileges_list}.")
AttributeError: 'Privileges' object has no attribute 'privileges_list'

我的解答思路和尝试过的方法
我想要达到的结果

你少写了下划线,所以认为你没有定义这个变量

class Privileges:
    #左右各两个下划线
    def __init__(self,privileges_list = ['can add post','can delete post','can ban user']):
        self.privileges_list = privileges_list
    def show_privileges(self):
        print(f"your privileges as follows:{self.privileges_list}.")

img

前后两个下划线

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632