Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-1-1_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
74e755c9
authored
Mar 13, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
28316a47
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
8 deletions
diy1.py
diy1.py
View file @
74e755c9
# 我们都爱夸夸夸
age
=
input
(
"你今年多少岁啦?"
)
if
int
(
age
)
>
12
:
p
rint
(
"你今年比我大"
+
str
(
int
(
age
)
-
12
)
+
"岁"
)
elif
int
(
age
)
<
12
:
p
rint
(
"你今年比我小"
+
str
(
12
-
int
(
age
))
+
"岁"
)
player
=
input
(
"请输入石头、剪刀、布:"
)
print
(
"玩家出拳:"
+
player
)
if
player
==
"石头"
:
p
=
1
elif
player
==
"剪刀"
:
p
=
2
else
:
print
(
"你今年和我一样大!"
)
\ No newline at end of file
p
=
3
import
random
as
r
c
=
r
.
randint
(
1
,
3
)
if
c
==
1
:
computer
=
"石头"
elif
c
==
2
:
computer
=
"剪刀"
else
:
computer
=
"布"
print
(
"计算机出拳:"
+
computer
)
def
pe1
(
c
):
if
c
==
1
:
print
(
"平局。"
)
elif
c
==
2
:
print
(
"玩家赢了。"
)
else
:
print
(
"计算机赢了。"
)
def
pe2
(
c
):
if
c
==
2
:
print
(
"平局。"
)
elif
c
==
3
:
print
(
"玩家赢了。"
)
else
:
print
(
"计算机赢了。"
)
def
pe3
(
c
):
if
c
==
3
:
print
(
"平局。"
)
elif
c
==
1
:
print
(
"玩家赢了。"
)
else
:
print
(
"计算机赢了。"
)
if
p
==
1
:
pe1
(
c
)
elif
p
==
2
:
pe2
(
c
)
else
:
pe3
(
c
)
\ 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