Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / lesson14_3

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • lesson14_3
  • diy2.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    save project · ea950baf
    BellCodeEditor committed 4 years ago
    ea950baf
diy2.py 423 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
class Hero():
    def __init__(self,name,hp,attack):
        self.level=1
        self.name=name
        self.hp=hp
        self.attack=attack
yase=Hero("亚瑟",60,355666)
print("亚瑟的血量为:",yase.hp)
houyi=Hero("后羿",222,4424242)
print("后羿的血量为:",houyi.hp)

def upgrade():
    yase.level=yase.level+1
    yase.hp=yase.hp+50
    yase.attack=yase.attack+4
upgrade()
upgrade()