Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson15_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
ac4e2e81
authored
Nov 09, 2025
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
f067a9ec
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
2 deletions
diy1.py
g.py
j.py
diy1.py
View file @
ac4e2e81
...
@@ -19,10 +19,10 @@ class Hero:
...
@@ -19,10 +19,10 @@ class Hero:
class
Player
(
Hero
):
class
Player
(
Hero
):
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
super
()
.
__init__
(
name
)
super
()
.
__init__
(
name
)
#
elf.level = 1
s
elf
.
level
=
1
self
.
hp
=
200
self
.
hp
=
200
self
.
attack
=
50
self
.
attack
=
50
#
self.name = name
self
.
name
=
name
yase
=
Hero
(
"垭瑟"
)
yase
=
Hero
(
"垭瑟"
)
houyi
=
Hero
(
"后羿"
)
houyi
=
Hero
(
"后羿"
)
...
...
g.py
0 → 100644
View file @
ac4e2e81
class
dog
:
def
__init__
(
self
):
self
.
footnum
=
4
self
.
eyenum
=
2
self
.
head
=
1
self
.
earsnum
=
2
self
.
skin
=
"while"
def
run
(
self
):
print
(
"狗狗飞快地跑起来"
)
class
husky
(
dog
):
def
__init__
(
self
):
self
.
skin
=
"black"
coco
=
husky
()
print
(
coco
.
skin
)
\ No newline at end of file
j.py
0 → 100644
View file @
ac4e2e81
class
cat
:
def
__init__
(
self
):
self
.
footnum
=
4
self
.
eyenum
=
2
self
.
head
=
1
self
.
earsnum
=
2
self
.
skin
=
"black"
def
run
(
self
):
print
(
"小猫飞快地跑起来"
)
def
skill
(
self
,
prey
):
print
(
"小猫抓住了"
+
prey
)
role
=
cat
()
role
.
skill
(
"老鼠"
)
\ 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