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
c08d4226
authored
Apr 09, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
e23c3d03
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
24 deletions
diy.py
diy2.py
diy.py
View file @
c08d4226
class
Hero
:
def
__main__
(
case
):
case
.
level
=
1
case
.
hp
=
300
case
.
attack
=
20
yase
=
Hero
()
print
(
yase
.
level
)
\ No newline at end of file
class
Hero
(
object
)
def
__init__
(
self
,
name
):
info1
=
self
.
name
+
"对"
+
self
.
enemy
+
"发起进攻"
info2
=
"造成"
+
str
(
self
.
attack
)
+
"点伤害"
info
=
\ No newline at end of file
diy2.py
View file @
c08d4226
class
Hero
:
def
__init__
(
self
,
name
,
level
,
hp
,
acttack
):
self
.
name
=
name
self
.
level
=
level
self
.
hp
=
hp
self
.
acttack
=
acttack
def
UpLevel
(
self
):
self
.
level
=
self
.
level
+
1
self
.
hp
=
self
.
level
+
50
self
.
acttack
=
self
.
acttack
+
4444
yase
=
Hero
(
"亚瑟"
,
1
,
20
,
40
)
yase
.
UpLevel
()
print
(
yase
.
acttack
)
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