Commit da764def by BellCodeEditor

save project

parent 09089178
Showing with 12 additions and 5 deletions
...@@ -4,7 +4,14 @@ class Hero: ...@@ -4,7 +4,14 @@ class Hero:
self.name = name self.name = name
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
laoshi = Hero('老师',99999,100)
banzhuren = Hero('班主任',199999,199) def upgrade():
print('老师的血量值为:',laoshi.hp) laoshi.level = laoshi.level + 1
print('班主任的血量值为:',banzhuren.hp) laoshi.hp = laoshi.hp + 50
\ No newline at end of file laoshi.attack laoshi.attack + 4
laoshi = Hero('老师',114514,100)
print('老师的初始血量值为:',laoshi.hp)
upgrade()
upgrade()
print('升级两次后,老师的血量值为:',laoshi.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