Commit 3cdf17f2 by BellCodeEditor

auto save

parent 70850cf8
Showing with 20 additions and 0 deletions
class Hero:
def __init__(self,name,attack,speed,hp):
self.level = 1
self.name = name
self.attack = attack
self.speed = speed
self.hp = hp
def uplevel(self):
self.level = self.level + 1
self.attack = self.attack + 5
self.hp = self.hp + 100
yase = Hero('yase',80,330,500)
houyi = Hero('houyi',100,310,300)
print("yase的血量为:",yase.hp)
yase.uplevel()
print("yase的等级为:",yase.level)
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