Commit a25b9019 by BellCodeEditor

save project

parent 3054fd70
Showing with 14 additions and 12 deletions
......@@ -4,19 +4,21 @@ class Hero:
self.hp=hp
self.level=level
self.name=name
def uplevel(self):
self.level=self.level+1
self.hp=self.hp+2000
self.attack=self.attack+50
def printdata(self):
print(self.name,"level=",self.level)
print(self.name,"attack=",self.attack)
print(self.name,"hp=",self.hp)
yase=Hero("yess",8000,150,15)
houyi=Hero("houyi",4000,1000,15)
def uplevel():
yase.level=yase.level+1
yase.hp=yase.hp+2000
yase.attack=yase.attack+50
uplevel()
uplevel()
uplevel()
print("yasedj:",yase.level)
print("hoyy:",houyi.level)
yase.uplevel()
houyi.uplevel()
\ No newline at end of file
yase.printdata()
houyi.printdata()
\ 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