Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_4
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
fc72bde8
authored
Dec 11, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
f2b8c4bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
diy2.py
diy2.py
View file @
fc72bde8
class
a
:
def
__init__
(
delf
,
name
,
hp
,
attack
):
delf
.
level
=
1
delf
.
name
=
name
delf
.
hp
=
hp
delf
.
attack
=
attack
def
up
(
delf
):
delf
.
level
=
delf
.
level
+
1
delf
.
hp
=
delf
.
hp
+
50
delf
.
attack
=
delf
.
attack
+
4
q
=
a
(
"jj"
,
30
,
20
)
q
.
up
()
print
(
"jrjk"
,
q
.
level
)
\ No newline at end of file
class
hero
:
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
level
=
1
self
.
hp
=
300
self
.
ak
=
40
def
pk
(
self
,
b
):
b
.
hp
=
b
.
hp
-
self
.
ak
ee1
=
self
.
name
+
'对'
+
b
.
name
+
'点伤害'
ee2
=
'造成'
+
b
.
name
+
'的'
+
str
(
self
.
ak
)
+
'点伤害'
ee3
=
b
.
name
+
'剩余'
+
str
(
b
.
hp
)
+
'血量'
print
(
ee1
+
ee2
+
ee3
)
yase
=
hero
(
'亚瑟'
)
houyi
=
hero
(
'后裔'
)
yase
.
pk
(
houyi
)
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