Commit a38f56c3 by BellCodeEditor

save project

parent 22354288
Showing with 20 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack,height):
self.name=name
self.hp=hp
self.attack=attack
self.height=height
def upgrade(self):
self.attack=self.attack+20
self.hp=self.hp+1
self.height=self.height+1
yase=Hero("亚瑟",1,300,1980)
nuoyi=Hero("诺依",1,140,12)
yase.upgrade()
print("hp=",yase.hp)
print("attack=",yase.attack)
print("height=",yase.height)
#所有身高以毫米做单位
\ 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