Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson12-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
641cb1e2
authored
Jun 23, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
c2179015
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
diy.py
diy.py
View file @
641cb1e2
self
.
attack
=
attack
class
Hero
:
def
__init__
(
self
,
name
,
Hp
,
attack
):
self
.
level
=
1
self
.
Hp
=
Hp
self
.
name
=
name
caozai
=
Hero
(
1
,
"曹仔"
,
300
,
20
)
print
(
caozai
.
level
,
caozai
.
Hp
,
caozai
.
attack
)
def
upgrade
()
class
Hero
:
def
__init__
(
self
,
level
,
name
,
Hp
,
attack
):
self
.
level
=
level
self
.
Hp
=
Hp
:
caozai
.
level
=
caozai
.
level
+
1
caozai
.
Hp
=
caozai
.
Hp
+
50
caozai
.
attack
=
caozai
.
attack
+
4
upgrade
()
upgrade
()
self
.
attack
=
attack
def
upgrade
(
self
):
self
.
level
=
self
.
level
+
1
self
.
Hp
=
self
.
Hp
+
50
self
.
attack
=
self
.
attack
+
4
caozai
=
Hero
(
"曹仔"
,
300
,
20
)
caozai
.
upgrade
()
print
(
caozai
.
level
,
caozai
.
Hp
,
caozai
.
attack
)
...
...
@@ -29,3 +27,4 @@ print(caozai.level,caozai.Hp,caozai.attack)
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