Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_test1
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
ec14a003
authored
Apr 08, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
09375f76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
1.py
2.py
3.py
1.py
View file @
ec14a003
class
Hero
:
def
__init__
(
self
,
name
):
self
.
name
=
name
self
.
level
=
1
self
.
hp
=
250
self
.
attack
=
40
def
gongji
(
self
,
dueifang
):
y1
=
self
.
name
+
'对'
+
dueifang
.
name
+
'发起攻击,'
y2
=
'造成'
+
str
(
self
.
attack
)
+
'点伤害,'
dueifang
.
hp
-=
self
.
attack
if
dueifang
.
hp
>
0
:
y3
=
dueifang
.
name
+
'还剩'
+
dueifang
.
hp
+
'点血'
print
(
y1
+
y2
+
y3
)
else
:
y3
=
dueifang
.
name
+
'已阵亡'
print
(
y1
+
y2
+
y3
)
exit
()
class
player
(
Hero
):
def
__init__
(
self
,
name
,
yingxiongleixin
):
super
.
__init__
(
name
):
self
.
hp
=
200
self
.
attack
=
50
self
.
yingxiongleixin
=
yingxiongleixin
print
(
self
.
name
+
'已创建'
+
self
.
yingxiongleixin
)
print
(
self
.
name
+
'的等级,血量,攻击分别是'
+
str
(
self
.
level
),
str
(
self
.
hp
),
str
(
self
.
attack
))
player
=
player
(
'后羿'
,
'射手'
)
\ No newline at end of file
2.py
0 → 100644
View file @
ec14a003
class
Box
:
def
__init__
(
self
,
chang
,
kuan
,
gao
):
self
.
chang
=
lenghth1
self
.
kuan
=
width1
self
.
gao
=
height1
def
volume
(
self
):
return
self
.
changI
*
self
.
kuan
*
self
.
gao
print
()
\ No newline at end of file
3.py
0 → 100644
View file @
ec14a003
class
studen
:
def
__init__
(
self
,
name
,
age
,
city
,
money
):
self
.
name
=
name
self
.
city
=
city
self
.
money
=
money
self
.
age
=
age
def
one
(
self
,
lesson
):
print
(
self
.
name
+
'学员正在学习'
+
lesson
+
'课程'
)
def
two
(
self
):
print
(
self
.
name
+
'期望薪资为'
+
self
.
money
)
w
=
studen
(
'sb'
,
15
,
'yu'
,
999
)
w
.
one
(
'vcgydevc'
)
\ 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