Commit 614c1e8c by BellCodeEditor

save project

parent 8a851862
Showing with 24 additions and 0 deletions
class hero:
def __init__(self,s,h,a):
self.leve = 0
self.name = s
self.hp = h
self.act = a
def up_leve(self):
self.leve = self.leve + 1
self.hp = self.hp + 10
self.act = self.act + 5
yase = hero("八戒",100,10)
yase.up_leve()
yase.up_leve()
yase.up_leve()
tangseng = hero("唐僧",0,0)
for i in range(1000):
tangseng.up_leve()
print(tangseng.hp,yase.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