Commit db8a61bd by BellCodeEditor

save project

parent be7ff570
Showing with 9 additions and 2 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level=1
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
self.name=name self.name=name
...@@ -7,4 +8,10 @@ class Hero: ...@@ -7,4 +8,10 @@ class Hero:
ys=Hero('ys',300,25) ys=Hero('ys',300,25)
hy=Hero('hy',250,30) hy=Hero('hy',250,30)
print(ys.name) print(ys.name)
print(hy.name) print(hy.name)
\ No newline at end of file def a():
ys.level=ys.level+1
ys.hp=ys.hp+50
ys.attack=ys.attack+20
a()
print(ys.hp)
\ 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