Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_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
16bc9bc5
authored
Nov 28, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
24785ed0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
diy2.py
diy2.py
View file @
16bc9bc5
class
daye
:
def
__init__
(
self
,
level
,
name
,
hp
,
attack
,):
self
.
level
=
level
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
attack
def
shengji
(
self
):
self
.
level
+=
1
self
.
hp
+=
5
self
.
attack
+=
10
wzry
=
daye
(
1
,
"赵云"
,
784
,
243
)
wzry
.
shengji
()
wzry
.
shengji
()
print
(
wzry
.
name
,
wzry
.
level
,
wzry
.
hp
,
wzry
.
attack
)
\ No newline at end of file
while
True
:
a
=
input
(
"请输入英雄名字:"
)
class
daye
:
def
__init__
(
self
,
level
,
name
,
hp
,
attack
,):
self
.
level
=
level
self
.
name
=
name
self
.
hp
=
hp
self
.
attack
=
attack
def
shengji
(
self
):
self
.
level
+=
1
self
.
hp
+=
5
self
.
attack
+=
10
timi
=
int
(
input
(
"请输入等级-1:"
))
#比如:3你需要写成2
wzry
=
daye
(
1
,
a
,
784
,
243
)
for
i
in
range
(
timi
):
wzry
.
shengji
()
print
(
wzry
.
name
,
"的资料为:"
,
"等级"
,
wzry
.
level
,
"血量"
,
wzry
.
hp
,
"攻击力"
,
wzry
.
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