Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson5_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
c4a88f46
authored
May 04, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
ebf4a21b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
diy1.py
diy1.py
View file @
c4a88f46
bro1
=
"刘备"
ciass
Hero
:
bro2
=
"关羽"
def
_init_
(
self
,
name
,
hp
,
attack
):
bro3
=
"张飞"
self
.
level
=
1
bros
=
[
"刘备"
,
"关羽"
,
"张飞"
]
self
.
name
=
name
bro1
=
[
"刘备"
,
161
,
9.1
]
self
.
hp
=
hp
bro2
=
[
"关羽"
,
160
,
8.5
]
self
.
attack
=
attack
bro3
=
[
"张飞"
,
166
,
8.3
]
bros
[
0
]
=
"关羽"
def
upgrade
(
self
):
bros
[
1
]
=
"刘备"
self
.
level
=
self
.
level
+
1
print
(
bros
)
self
.
hp
=
self
.
hp
+
50
self
.
attack
=
self
.
attack
+
4
houyi
=
Hero
(
"后羿"
,
240
,
23
)
houyi
.
upgrade
print
(
"等级为:"
,
houyi
.
level
)
print
(
"血量为:"
,
houyi
.
hp
)
print
(
"攻击力为:"
,
houyi
.
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