Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-5_DIY1
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
272c8efc
authored
Sep 25, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
fe0b09e6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
11 deletions
2.py
guguih.py
jjj.py
jk.py
2.py
0 → 100644
View file @
272c8efc
class
Aninal
:
def
__init__
(
self
,
color
):
self
.
foot
=
4
self
.
color
=
color
def
eat
(
self
):
print
(
"和爸爸好吧好吧hi不合格v给v"
)
class
Cat
(
Aninal
):
pass
pet
=
Cat
(
"black"
)
pet
.
eat
()
print
(
pet
.
foot
)
\ No newline at end of file
guguih.py
0 → 100644
View file @
272c8efc
jjj.py
0 → 100644
View file @
272c8efc
import
random
player
=
input
(
"请出拳(石头,剪刀,布):"
)
list
=
[
"石头"
,
"剪刀"
,
"布"
]
computer
=
random
.
choice
(
list
)
print
(
"玩家请出拳:"
+
player
)
print
(
"zhi算zhi请出拳:"
+
comepuer
)
if
player
in
list
:
if
player
==
computer
:
print
(
"平zhi"
)
elif
(
player
==
"石头"
and
coputer
==
"剪刀"
)
or
(
player
==
"剪刀"
)
or
(
player
==
""
):
\ No newline at end of file
jk.py
View file @
272c8efc
if
player
==
computer
:
class
Hero
:
print
(
"平局"
)
def
__init__
(
self
,
name
):
elif
player
==
"石头"
and
computer
==
"剪刀"
:
self
.
level
=
1
print
(
"恭喜,你赢了"
)
self
.
hp
=
250
elif
player
==
"剪刀"
and
computer
==
"布"
:
self
.
attack
=
40
print
(
"恭喜,你赢了)
self
.
name
=
name
elif player=="
布
"and computer=="
石头
":
print("
恭喜你,你赢了
")
else:
def
combat
(
self
,
enemy
):
print("
很遗憾,你输了
")
enemy
.
hp
-=
self
.
attack
\ No newline at end of file
info1
=
self
.
name
+
"对"
+
enemy
.
name
+
"发起进攻"
info2
=
"造成"
+
str
(
self
.
attack
)
+
"伤害,"
if
enemy
.
hp
>
0
:
info3
=
enemy
.
name
+
"还剩"
+
str
(
enemy
.
hp
)
+
"血量"
info
=
info1
+
info2
+
info3
print
(
info
)
else
:
info3
=
enemy
.
name
+
"阵亡,游戏结束"
info
=
info1
+
info2
+
info3
print
(
info
)
exit
()
yase
=
Hero
(
"亚瑟"
)
houyi
=
Hero
(
"后羿"
)
yase
.
combat
(
houyi
)
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