Commit 6f0a747b by BellCodeEditor

save project

parent 22354288
Showing with 23 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attck):
self.name=name
self.hp=hp
self.attck=attck
self.level=1
def upgrade(self):
self.level+=1
self.hp+=50
self.attck+=90
a=Hero("a",25000,950)
a.upgrade()
print(a.level)
print(a.hp)
print(a.attck)
b=Hero('b',40000,1000)
b.upgrade()
print(a.level)
print(a.hp)
print(a.attck)
\ 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