Commit df5340f0 by BellCodeEditor

save project

parent 5f30fce5
Showing with 13 additions and 3 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level= 1 self.level= 1
self.name=name self.name = name
self.hp= hp self.hp = hp
self.attack= attack self.attack = attack
def upgrade():
jeige.level = jeige.level+1
jeige.hp = jeige.hp+50
jeige.attack = jeige.attack+10
jeige = Hero("杰哥",300,10)
upgrade()
print("杰哥的血量:",jeige.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