Commit 54fd0321 by BellCodeEditor

save project

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