Commit b8dd448a by BellCodeEditor

save project

parent 3500667c
Showing with 12 additions and 7 deletions
class Heyo:
def __init__(self,name,hp,attack):
self.level = 1
self.name=name
self.hp=hp
self.attack=attack
yase = Heyo('垭瑟',300,20)
houyi = Heyo('后羿',250,25)
libai = Heyo('李白',350,15)
print("垭瑟的血量为:",yase.hp)
print("后羿的血量为:",houyi.hp)
print("李白的血量为:",libai.hp)
\ No newline at end of file
def upgrade():
yase.level=yase.level+1
yase.hp=yase.hp+100
yase.attack=yase.attack+100
yase = Heyo("垭瑟",300,20)
print("垭瑟的初始血量为:",yase.hp)
upgrade()
upgrade()
print("升级2次后,垭瑟的血量为:",yase.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