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
0321f519
authored
Apr 21, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
d6496433
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
37 deletions
1。py/0.py
1。py/2.py
1。py/fff.py
1。py/0.py
View file @
0321f519
class
Hero
:
class
Hero
:
class
Hero
:
def
__init__
(
self
,
name
,
hp
,
attack
):
self
.
level
=
1
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
attack
def
upgrade
():
yase
.
level
=
yase
.
level
+
2
yase
.
hp
=
yase
.
hp
+
50
yase
.
attack
=
yase
.
attack
+
4
yase
=
Hero
(
"亚瑟"
,
300
,
20
)
print
(
"亚瑟的初始血量值为:"
,
yase
.
hp
)
print
(
"亚瑟的初始等级为:"
,
attack
.
hp
)
upgrade
()
upgrade
()
upgrade
()
upgrade
()
upgrade
()
upgrade
()
upgrade
()
upgrade
()
print
(
"升级6次后,亚瑟的血量值为:"
,
yase
.
hp
)
print
(
"升级6次后,亚瑟的攻击力为:"
,
yas
.
level
)
\ No newline at end of file
def
__init__
(
self
):
self
.
level
=
9
self
.
hp
=
999
self
.
attack
=
999
xiangyu
=
Hero
()
print
(
"项羽的血量值为:"
,
xiangyu
.
hp
)
print
(
"项羽的攻击力为:"
,
xiangyu
.
attack
)
\ No newline at end of file
1。py/2.py
View file @
0321f519
class
Hero
:
++ "b/1\343\200\202py/2.py"
class
Hero
:
def
__init__
(
self
,
name
,
hp
,
attack
):
self
.
level
=
1
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
attack
yase
=
Hero
(
"亚瑟"
,
300
,
20
)
houyi
=
Hero
(
"后羿"
,
240
,
23
)
print
(
"亚瑟的血量为:"
,
yase
.
hp
,
"亚瑟的攻击力:"
,
yase
.
attack
)
print
(
"后羿的血量为:"
,
houyi
.
hp
,
"后羿的攻击力:"
,
houyi
.
attack
)
\ No newline at end of file
1。py/fff.py
0 → 100644
View file @
0321f519
++ "b/1\343\200\202py/fff.py"
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