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
c3d0f0bc
authored
May 13, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
4cfe5b61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
22 deletions
1.py
diy1.py
1.py
0 → 100644
View file @
c3d0f0bc
plauer
=
input
(
"请出拳(石头/剪刀/布):"
)
print
(
"玩家出拳:"
+
plauer
)
import
random
list
=
[
"石头"
,
"剪刀"
,
"布"
]
computer
=
random
.
choice
(
list
)
print
(
"计算机出拳:"
+
computer
)
if
plauer
==
computer
:
print
(
"平局"
)
elif
(
plauer
==
"石头"
and
computer
==
"剪刀"
)
or
(
plauer
==
"布"
and
computer
==
"石头"
)
or
(
plauer
==
"剪刀"
and
computer
==
"布"
):
print
(
"胜利"
)
else
:
print
(
"输了"
)
\ No newline at end of file
diy1.py
deleted
100644 → 0
View file @
4cfe5b61
# 英雄角色类
class
Hero
(
object
):
def
__init__
(
self
,
name
):
self
.
level
=
1
self
.
hp
=
250
self
.
attack
=
40
self
.
name
=
name
def
combat
(
self
,
enemy
):
# 攻击
enemy
.
hp
-=
self
.
attack
infe1
=
self
.
name
+
"对"
+
enemy
.
name
+
"发起攻击"
infe2
=
"造成"
+
str
(
self
.
attack
)
+
"点伤害"
if
enemy
.
hp
>
0
:
infe3
=
enemy
,
name
+
"还剩下"
+
str
(
enemy
.
hp
)
+
""
infe
=
infe1
+
infe2
+
infe3
print
(
infe
)
else
:
infe3
=
enemy
.
name
+
""
infe
=
infe1
+
infe2
+
infe3
print
(
infe
)
exit
()
\ 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