Commit b41389bd by BellCodeEditor

auto save

parent 5514e1de
Showing with 23 additions and 8 deletions
class cat:
def __init__(self,type,color,price)
self.footNum=4
self.type=type
self.color=color
self.price=price
self.many=many
def say_price(self):
print("猫猫的价格为"+str(self.price)+"元"
animal=Cat("波斯猫","white",4000)
animal.say_price()
\ No newline at end of file
......@@ -9,16 +9,16 @@ class Hero():
def upgrade():
self.level=yase.level+1
self.hp=yase.hp+50
self.attack=yase.attack+4
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
yase=Hero("亚瑟",300,20)
dorl=upgrade()
print("等级为:",dorl.level)
print("血量为:",dorl.hp)
print("攻击为:",dorl.attack)
yase.upgrade()
print("等级为:",yase.level)
print("血量为:",yase.hp)
print("攻击为:",yase.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