Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_3
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
20671fd3
authored
Oct 30, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
5d74f7bc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
level.py
level.py
View file @
20671fd3
...
@@ -4,21 +4,20 @@ class Hero:
...
@@ -4,21 +4,20 @@ class Hero:
self
.
name
=
name
self
.
name
=
name
self
.
hp
=
hp
self
.
hp
=
hp
self
.
attack
=
attack
self
.
attack
=
attack
def
upgrade
(
self
):
self
.
level
=
self
.
level
+
1
self
.
hp
=
self
.
hp
+
50
self
.
attack
=
self
.
attack
=
5
xiaobei
=
Hero
(
"小贝"
,
300
,
80
)
def
upgrade
():
xiaobei
.
level
=
xiaobei
.
level
+
1
xiaobei
.
hp
=
xiaobei
.
hp
+
50
xiaobei
.
attack
=
xiaobei
.
attack
=
5
xiaobei
=
Hero
(
"小贝"
,
300
,
80
)
nuoyi
=
Hero
(
"诺依"
,
200
,
60
)
print
(
"小贝的初始血量是:"
,
xiaobei
.
hp
)
print
(
"小贝的初始血量是:"
,
xiaobei
.
hp
)
print
(
"小贝的初始攻击力是:"
,
xiaobei
.
attack
)
print
(
"诺依的初始攻击力是:"
,
nuoyi
.
attack
)
xiaobei
.
upgrade
()
nuoyi
.
upgrade
()
upgrade
()
print
(
"提高1级后小贝的血量是:"
,
xiaobei
.
hp
)
upgrade
()
print
(
"提高1级后诺依的攻击力是:"
,
nuoyi
.
attack
)
upgrade
()
\ No newline at end of file
upgrade
()
print
(
"提高4级后小贝的血量是:"
,
xiaobei
.
hp
)
print
(
"提高4级后小贝的攻击力是:"
,
xiaobei
.
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