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
eab27a87
authored
Nov 07, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
9bf3a913
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
diy2.py
diy2.py
View file @
eab27a87
class
Hero
:
def
__init__
(
salt
,
HP
,
MP
,
speed
):
salt
.
HP
=
HP
salt
.
MP
=
MP
salt
.
speed
=
speed
def
__init__
(
self
,
name
,
mp
,
hp
,
level
):
self
.
name
=
name
self
.
mp
=
mp
self
.
hp
=
hp
self
.
level
=
level
yase
=
Hero
(
300
,
200
,
120
)
houyi
=
Hero
(
250
,
300
,
200
)
def
upgrade
(
hero
,
new_mp
,
new_hp
,
new_level
):
hero
.
mp
=
new_mp
hero
.
hp
=
new_hp
hero
.
level
=
new_level
def
upgrade
(
hero
):
hero
.
mp
=
hero
.
mp
+
50
hero
.
hp
=
hero
.
hp
+
50
hero
.
level
=
hero
.
level
+
1
def
upgrade
():
yase
.
HP
=
yase
.
HP
+
10
yase
.
MP
=
yase
.
MP
+
20
yase
.
speed
=
yase
.
speed
+
50
upgrade
()
print
(
yase
.
speed
)
\ No newline at end of file
yase
=
Hero
(
'yase'
,
200
,
300
,
1
)
print
(
yase
.
level
)
upgrade
(
yase
)
print
(
yase
.
level
)
\ 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