Commit 641f0a0c by BellCodeEditor

save project

parent 0dd5b2ab
Showing with 21 additions and 24 deletions
class Hero: # class Hero:
def __init__(self,name,hp,attack): # def __init__(self,name,hp,attack):
self.level=1 # self.level=1
# self.name=name
# self.hp=hp
# self.attack=attack
# def shenji(self):
# self.level = self.level+1
# self.hp=self.hp+50
# self.attack = self.attack+4
# yase=Hero('后裔',300,20)
# houyi.shenji()
class cat():
def __init__(self,name,age,sex,hungry):
self.name=name self.name=name
self.hp=hp self. age=age
self.attack=attack
class SB:
def __init__(self,name,sex,age):
self.name = name
self.sex = sex self.sex = sex
self.age = age self.hungry = hungry
ren1 = sb("niuniu","nan","25")
print(ren1.name)
print(ren1.age)
print(ren1.sex)
def eat(self):
self.hungry = self.hungry -1
cat1 = cat("猫a",10,"max",5)
cat1.name = "猫aa"
cat1.eat()
yase=Hero('yase',300,20)
hy=Hero('hy',250,23)
k=Hero('K',5600,199)
print(yase.attack)
print(hy.attack)
print(k.attack)
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