Commit 5f244abc by BellCodeEditor

save project

parent 6b1a3564
Showing with 26 additions and 1 deletions
...@@ -4,8 +4,32 @@ class hero: ...@@ -4,8 +4,32 @@ class hero:
self.level=1 self.level=1
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yao = hero("耀",3000,600) yao = hero("耀",3000,600)
print("耀的血量为:",yao.hp) print("耀的血量为:",yao.hp)
print("耀的等级为:",yao.level) print("耀的等级为:",yao.level)
print("耀的攻击为:",yao.attack) print("耀的攻击为:",yao.attack)
def up(self):
self.hp=self.hp+500
self.level=self.level+1
self.attack=self.attack+100
yao.up()
print("耀的属性发生了变化!")
print("耀的血量为:",yao.hp)
print("耀的等级为:",yao.level)
print("耀的攻击为:",yao.attack)
yao.up()
print("耀的属性发生了变化!")
print("耀的血量为:",yao.hp)
print("耀的等级为:",yao.level)
print("耀的攻击为:",yao.attack)
yao.up()
print("耀的属性发生了变化!")
print("耀的血量为:",yao.hp)
print("耀的等级为:",yao.level)
print("耀的攻击为:",yao.attack)
yao.up()
print("耀的属性发生了变化!")
print("耀的血量为:",yao.hp)
print("耀的等级为:",yao.level)
print("耀的攻击为:",yao.attack)
yao.up()
\ 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