# test 9-7 (3)
class User():
def __init__(self , first_name , last_name , number , address , Email):
self.first = first_name
self.last = last_name
self.number = number
self.address = address
self.email = Email
self.login_attempts = 0
def describe_user(self):
print("用户名:" + self.first + self.last)
print("电话:" + self.number)
print("地址:" + self.address)
print("邮箱:" + self.email)
def greet_user(self):
print("你好,这是你的个人信息。")
def fang(self):
print("这个值现在是: " + str(self.login_attempts) + "!")
def fa(self , number):
self.login_attempts = number
def increment_login_attempts(self , num):
self.login_attempts += num
def youbing(self , bing):
self.login_attempts = bing
class Admin(User):
def __init__(self,first_name,last_name,number,address,Email):
super().__init__(first_name,last_name,number,address,Email)
self.privileges = ()
def show_privileges(self):
print("\n管理员的权限是:")
for show_privileges in self.privileges:
print(show_privileges)
my_admin = Admin('a','b','c','d','e')
my_admin.privileges = ('can add post','can delete post','can ban user')
my_admin.describe_user()
my_admin.show_privileges()
weixin_45707364
发布了101 篇原创文章 · 获赞 0 · 访问量 670
私信
关注