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
0522451b
authored
Jul 02, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
0e18de62
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
diy.py
diy.py
View file @
0522451b
class
Hero
:
desc
=
"
这是个角色
"
desc
=
"
煲仔饭的属性:
"
def
__init__
(
self
):
self
.
level
=
1000
self
.
hp
=
9999999
self
.
gongjili
=
999
gaozesheng
=
Hero
()
def
__init__
(
self
,
name
,
hp
,
level
,
attack
):
self
.
name
=
name
self
.
level
=
level
self
.
hp
=
hp
self
.
attack
=
attack
gaozesheng
=
Hero
(
"煲仔饭"
,
99999
,
1000
,
999
)
print
(
Hero
.
desc
)
print
(
gaozesheng
.
hp
)
print
(
"角色的名字"
,
gaozesheng
.
name
)
print
(
"煲仔饭的血量"
,
gaozesheng
.
hp
)
print
(
"煲仔饭的等级"
,
gaozesheng
.
level
)
print
(
"煲仔饭的攻击力"
,
gaozesheng
.
attack
)
mengziyun
=
Hero
(
"鳗鱼饭"
,
89537
,
1000
,
1023
)
print
(
Hero
.
desc
)
print
(
"角色的名字"
,
mengziyun
.
name
)
print
(
"鳗鱼饭的血量"
,
mengziyun
.
hp
)
print
(
"鳗鱼饭的等级"
,
mengziyun
.
level
)
print
(
"鳗鱼饭的攻击力"
,
mengziyun
.
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