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
052e7bce
authored
Jun 27, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
417f60d7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
0 deletions
diy.py
e.py
m.py
w.py
diy.py
View file @
052e7bce
...
...
@@ -10,3 +10,14 @@ chenshi = Hero("chensi",10000,10000)
print
(
chenshi
.
name
+
"攻击力是:"
+
str
(
chenshi
.
attack
))
print
(
yuyi
.
name
+
"攻击力:"
+
str
(
yuyi
.
attack
))
yuyi
=
Hero
(
"雨衣"
,
10000
,
10000
)
chenshi
=
Hero
(
"chensi"
,
10000
,
10000
)
print
(
chenshi
.
name
+
"攻击力是:"
+
str
(
chenshi
.
attack
))
print
(
yuyi
.
name
+
"攻击力:"
+
str
(
yuyi
.
attack
))
yuyi
=
Hero
(
"雨衣"
,
10000
,
10000
)
chenshi
=
Hero
(
"chensi"
,
10000
,
10000
)
print
(
chenshi
.
name
+
"攻击力是:"
+
str
(
chenshi
.
attack
))
print
(
yuyi
.
name
+
"攻击力:"
+
str
(
yuyi
.
attack
))
\ No newline at end of file
e.py
0 → 100644
View file @
052e7bce
class
Hero
:
def
__init__
(
self
):
self
.
level
=
1
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
a
class
Hero
:
def
__init__
(
self
):
self
.
level
=
1
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
attack
yuyi
=
Hero
(
"雨衣"
,
10000
,
10000
)
chenshi
=
Hero
(
"chensi"
,
10000
,
10000
)
print
(
chenshi
.
name
+
"攻击力是:"
+
str
(
chenshi
.
attack
))
print
(
yuyi
.
name
+
"攻击力:"
+
str
(
yuyi
.
attack
))
m.py
0 → 100644
View file @
052e7bce
class
Hero
:
def
__init__
(
self
):
self
.
level
=
1
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
attack
def
upgrade
():
chenshi
.
level
=
chenshi
.
level
+
1
chenshi
.
hp
=
chenshi
.
hp
+
50
chenshi
.
attack
=
chenshi
.
attack
+
4
chenshi
=
Hero
(
"chenshi"
,
300
,
20
)
print
(
chenshi
.
name
+
"一级攻击力是:"
+
str
(
chenshi
.
attack
))
upgarde
()
upgarde
()
upgarde
()
print
(
chenshi
.
name
+
"一级攻击力是:"
+
str
(
chenshi
.
attack
))
\ No newline at end of file
w.py
0 → 100644
View file @
052e7bce
class
Hero
:
def
__init__
(
self
):
self
.
level
=
1
self
.
name
=
name
self
.
hp
=
hp
self
.
a
chenshi
=
Hero
(
"chensi"
,
10000
,
10000
)
print
(
chenshi
.
name
+
"攻击力是:"
+
str
(
chenshi
.
attack
))
print
(
yuyi
.
name
+
"攻击力:"
+
str
(
yuyi
.
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