Commit 7edf9c40 by BellCodeEditor

auto save

parent ef39df1c
Showing with 41 additions and 5 deletions
class Miss:
def __init__(self):
self.level = 2
self.hp = 200
self.attack = 77
xishi = Miss()
print("西施的血量值为:",xishi.hp)
print("西施的等级为:",xishi.level)
print("西施的攻击力为:",xishi.attack)
\ No newline at end of file
class hero:
def __init__(self):
self.level=1
self.hp=300
self.attack=2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
class Miss:
def __init__(self,name,hp,attack):
self.level = 2
self.name = name
self.hp = hp
self.attack = attack
xishi = Miss("西施",70,200)
lindaiyu = Miss("林黛玉",60,190)
print("西施的血量值为:",xishi.hp,"西施的攻击力为:",xishi.attack)
print("林黛玉的血量值为:",lindaiyu.hp,"林黛玉的攻击力为:",lindaiyu.attack)
class Miss:
def __init__(self,name,hp,attack):
self.level = 2
self.name = name
self.hp = hp
self.attack = attack
def miss():
xishi.level = xishi.level+1
xishi.hp = xishi.hp+50
xishi.attack = xishi.attack+4
xishi = Miss("西施",200,70)
print("西施的初始血量值为:",xishi.hp)
miss()
miss()
print("升级2次后,西施的血量值为:",xishi.hp)
print("升级2次后,西施的等级为:",xishi.level)
print("升级2次后,西施的攻击力为:",xishi.attack)
\ 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