Commit 41627772 by BellCodeEditor

save project

parent 22354288
Showing with 22 additions and 0 deletions
class datas:
def __init__(self,name,lv,hp,at,df):
self.name = name
self.lv = lv
self.hp = hp
self.at = at
self.df = df
def upgrade(self):
self.lv = self.lv + 1
self.hp = self.hp + 50
self.at = self.at + 2
self.df = self.df + 2
ys = datas("亚瑟",1,300,20,10)
hy = datas("后羿",1,240,23,8)
print(ys.hp,"\n",hy.at)
hy.upgrade()
ys.upgrade()
print(ys.hp,"\n",hy.at)
\ 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