Commit 9fe1ea8f by BellCodeEditor

save project

parent d0099acb
Showing with 24 additions and 10 deletions
......@@ -4,15 +4,30 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
def upgrand(self):
self.level=self.level+1
self.hp=self.hp+1
self.attack=self.attack+1
yase=Hero('亚瑟',300,20)
hy=Hero('后羿',250,23)
k=Hero('凯',5600,200)
print(yase.attack)
print(hy.attack)
print(k.name)
def upgrand():
yase.level=yase.level+1
yase.hp=yase.hp+1
yase.attack=yase.attack+1
upgrand()
print(yase.level)
\ No newline at end of file
# print(yase.attack)
# print(hy.attack)
print(k.level)
k.upgrand()
print(k.level)
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