Commit 2f4e6822 by BellCodeEditor

save project

parent e83976d4
Showing with 14 additions and 8 deletions
class Hero:
def __init__(self):
def __init__(self,name,hp,attack):
self.level=1
self.hp=300
self.attack=20
yese=Hero()
print("yese等级:",yese.level)
print("yese血量:",yese.hp)
print("yese攻击:",yese.attack)
\ No newline at end of file
self.name=name
self.hp=hp
self.attack=attack
def upgrade():
yese.level=yese.level+1
yese.hp=yese.hp+50
yese.attack=yese.attack+4
yese=Hero("垭瑟",300,20)
print("垭瑟血量:",yese.hp)
upgrade()
upgrade()
print("垭瑟血量:",yese.hp)
\ No newline at end of file
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