Commit 54fd0321 by BellCodeEditor

save project

parent 427a278a
Showing with 11 additions and 7 deletions
class Warrior: class Warrior:
def __init__(self,name,age,level,skill): def __init__(self,name,hp,level,skill,attack):
self.name=name self.name=name
self.age=age self.hp=hp
self.level=level self.level=level
self.skill=skill self.skill=skill
gy=Warrior('关羽',46,555,'青龙斩') self.attack=attack
lb=Warrior('刘备',48,469,'剑指凌霄') gy=Warrior('关羽',500,55,'青龙斩',88)
print(gy.skill) def improve():
print(lb.name) gy.level=gy.level+1
\ No newline at end of file gy.hp=gy.hp+50
gy.attack=gy.attack+25
improve()
improve()
print(gy.hp)
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