Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_1
This project
Loading...
Sign in
Toggle navigation
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
Commit
becd35fd
authored
Nov 06, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
c4f2f49c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
diy.py
diy.py
View file @
becd35fd
...
@@ -5,8 +5,18 @@ class Hero:
...
@@ -5,8 +5,18 @@ class Hero:
self
.
hp
=
hp
self
.
hp
=
hp
self
.
attack
=
attack
self
.
attack
=
attack
yase
=
Hero
(
"亚瑟"
,
1000
,
2000
)
#yase = Hero("亚瑟",1000,200)
houyi
=
Hero
(
"后裔"
,
550
,
100
)
#houyi = Hero("后裔",550,100)
print
(
"输出亚瑟的血量:"
yase
.
hp
)
#print("亚瑟血量:",yase.hp)
print
(
"输出后裔的血量:"
houyi
.
hp
)
#print("后裔血量",houyi.hp)
def
upgrade
(
self
):
self
.
level
=
self
.
level
+
1
self
.
hp
=
self
.
hp
+
200
self
.
attack
=
self
.
attack
+
100
yase
=
Hero
(
"亚瑟"
,
1000
,
200
)
yase
.
upgrade
()
print
(
"亚瑟等级:"
,
yase
.
level
)
print
(
"亚瑟生命"
,
yase
.
hp
)
print
(
"亚瑟伤害"
,
yase
.
attack
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment