Commit da9fa6b9 by BellCodeEditor

save project

parent 65331369
Showing with 21 additions and 0 deletions
class Hero:
def __init__ (self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
NB=Hero("NB",500,50)
DCM=Hero("DCM",300,60)
print("NB血量为:",NB.hp)
print("DCM血量为:",DCM.hp)
def upgrade():
NB.level=NB.level+1
NB.hp=NB.hp+20
NB.attack=NB.attack+5
print("NB血量为:",NB.hp)
upgrade()
upgrade()
print("NB血量为:",NB.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