马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
class User():
def __init__(self,name,age,length_of_life,value):
self.name = name.title()
self.age = age
self.length_of_life = length_of_life
self.value = value
def greet_user(self):
if self.value > 100:
msg = "您好,帝国的建设者:" + self.name + "阁下!"
print(msg)
elif self.age/self.length_of_life < 0.3:
msg = "生命正当时,天地大可为"
print(msg)
else:
msg = "请在收到此信息后两个地球年内前往生化部报道"
print(msg)
def query_contribution_value(self):
if self.value > 100:
msg = "感谢您对帝国做过的贡献,您的贡献值为:"+ str(self.value)+ "."
print(msg)
else:
print(self.value)
def convertible_thing(self):
a = ["虚拟实境","马克二型","绝境血清PRO","零级图书馆借阅卡*1"]
b = a + ["冷兵器时代星球","暗能机甲","黑光血清PRO","一级图书馆借阅卡*1"]
c = b + ["探索者级飞船","机器工厂模块","帝国图书馆借阅卡*1"]
if self.value < 66:
print(a)
elif self.value < 100:
print(b)
elif self.value >= 100:
print(c)
u1 = User("Z",25,150,101)
u1.query_contribution_value()
本来是会报错的,显示不能用字符串链接字符串。但为什么我睡一觉起来就能运行了!??? 还真是梦里啥都有
所以为什么呢 。。。。。 |