Commit fdd89060 by BellCodeEditor

save project

parent 22354288
Showing with 23 additions and 0 deletions
class hero:
def __init__(pop,name,hp,att):
pop.name = name
pop.hp = hp
pop.ieve = 1
pop.att = att
def upgrade(self):
self.hp = self.hp-10
self.ieve = self.ieve+1
self.att = self.att+1
lijunyi=hero("李俊毅是",250,0.1)
lijunyi.upgrade()
lijunyi.upgrade()
print(lijunyi.name)
huang=hero("黄",278,0.1)
huang.upgrade()
huang.upgrade()
print(huang.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