Commit 5cfa0782 by BellCodeEditor

save project

parent a1b72b43
Showing with 14 additions and 3 deletions
...@@ -7,5 +7,17 @@ class Hero: ...@@ -7,5 +7,17 @@ class Hero:
yase = Hero("齐天大圣",500,40) yase = Hero("齐天大圣",500,40)
qqqqq = Hero("众神之王",1000,20) qqqqq = Hero("众神之王",1000,20)
print("齐天大圣血量为:",yase.hp,"齐天大圣攻击力为:",yase.attack) #print("齐天大圣血量为:",yase.hp,"齐天大圣攻击力为:",yase.attack)
print("众神之王血量为:",qqqqq.hp,"齐天大圣攻击力为:",qqqqq.attack)
\ No newline at end of file def upgrade():
yase.leve1 = yase.leve1 + 1
yase.hp = yase.hp+500
yase.attack = yase.attack + 50
yase = Hero("齐天大圣",500,40)
print("齐天大圣的初始数据为:",yase.hp,yase.attack)
upgrade()
upgrade()
print("齐天大圣升1级数据为:",yase.hp,yase.attack)
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