Commit d60e5379 by BellCodeEditor

save project

parent df61f8b9
Showing with 10 additions and 4 deletions
class Hero: class Hero:
def __init__(self,name,level,hp,attack): def __init__(self,name,emv,hp,attack):
self.name=name self.name=name
self.level=level self.emv=emv
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
steve=Hero('史蒂夫',5,20,3) def jjj():
alics=Hero('艾利克斯',4,25,1) steve.emv+=1
steve.hp+=2
steve.attack+=2
steve=Hero('史蒂夫',0,20,3)
alics=Hero('艾利克斯',0,25,1)
jjj()
print(steve.hp) print(steve.hp)
print(alics.hp) print(alics.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