Commit 107f65ca by BellCodeEditor

save project

parent 22354288
class hero():
def __init__(self,name,level,hp,attack):
self.name = name
self.level = level
self.hp = hp
self.attack = attack
def up(self):
self.level= self.level + 1
self.hp= self.hp + 1000
self.attack= self.attack + 100
houyi = hero("houyi",15,21000,10000)
print(houyi.name,houyi.level,houyi.hp,houyi.attack)
houyi.up()
print(houyi.name,houyi.level,houyi.hp,houyi.attack)
\ 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