Commit fa66d661 by BellCodeEditor

save project

parent d6c81a0f
Showing with 20 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=114514
self.name=name
self.hp=hp
self.attack=attack
def upgrade():
Dio.level=Dio.level+1
Dio.hp=Dio.hp+50
Dio.attack=Dio.attack+4
Dio = Hero("Dio",300,20)
print("Dio的初始血量:",Dio.hp)
upgrade()
upgrade()
print("升级2次后,Dio的血量值为:",Dio.hp)
kfc = Hero("kfc",240,23)
print('Dio的血量值为:',Dio.hp)
print("kfc的血量值为:",kfc.hp)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment