Commit 651e2eb0 by BellCodeEditor

save project

parent 22354288
Showing with 17 additions and 0 deletions
class Hero:
def __init__(self,name,hp,gongji):
self.level=1
self.name=name
self.hp=hp
self.gongji=gongji
def cjwd(self):
self.level=self.level+1
self.hp=self.hp+50
self.gongji=self.gongji+5
tanyayun=Hero('炭雅均',114514,114)
ysmj=Hero('毛巾卷',258000,114514)
tanyayun.cjwd()
ysmj.cjwd()
print("炭雅均的生命值是:",tanyayun.hp)
print("毛巾卷的生命值是:",ysmj.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