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
be4d55b4
authored
May 05, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
cd4c771d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
12 deletions
diy.py
diy1.py
diy2.py
diy.py
0 → 100644
View file @
be4d55b4
student1
=
{
"语文"
:
100
,
"数学"
:
100
,
"英语"
:
100
}
student2
=
{
"语文"
:
99
,
"数学"
:
99
,
"英语"
:
99
}
student3
=
{
"语文"
:
98
,
"数学"
:
98
,
"英语"
:
98
}
score
=
{
"悟空"
:
student1
,
"小贝"
:
student2
,
"诺依"
:
student3
}
while
True
:
name
=
input
(
"请输入姓名:"
)
if
name
in
score
:
info_score
=
score
[
name
]
print
(
"**"
*
20
)
for
k
,
v
in
info_score
.
items
():
print
(
k
,
v
)
print
(
"**"
*
20
)
else
:
print
(
"**"
*
20
)
print
(
"输入错误"
)
print
(
"**"
*
20
)
\ No newline at end of file
diy1.py
View file @
be4d55b4
import
turtle
len
=
100
screen
=
turtle
.
Screen
()
print
(
"玩家出"
+
player
)
screen
.
bgcolor
(
"pink"
)
list
[
"剪刀"
+
"石头"
+
"布"
]
pen
=
turtle
.
Pen
()
computer
=
random
.
choice
(
list
)
pen
.
pensize
(
5
)
print
(
"计算机出了:"
+
cumputer
)
pen
.
penup
()
if
(
player
==
"剪刀"
and
computer
==
"布"
)
or
(
player
==
"布"
and
computer
==
"石头"
)
or
(
player
==
"石头"
andcomputer
==
"剪刀"
):
pen
.
goto
(
100
,
-
100
)
print
(
"玩家赢了"
)
pen
.
pencolor
(
'red'
)
else
:
pen
.
write
(
"春晓
\n
春眠不觉晓
\n
处处闻啼鸟
\n
夜来风雨声
\n
花落知多少"
,
font
=
(
"Times"
,
20
,
'normal'
))
print
(
"玩家输了"
)
pen
.
goto
(
-
50
,
-
100
)
\ No newline at end of file
pen
.
pendown
()
pen
.
left
(
45
)
pen
.
forward
(
len
)
pen
.
circle
(
50
,
180
)
pen
.
right
(
90
)
pen
.
circle
(
50
,
180
)
pen
.
forward
(
len
)
pen
.
hideturtle
()
turtle
.
done
()
\ No newline at end of file
diy2.py
0 → 100644
View file @
be4d55b4
name
=
"abc"
mima
=
"12345"
while
True
:
name2
=
input
(
"请输入用户名:"
)
mima2
=
input
(
"请输入密码:"
)
if
name2
=
name
and
mima2
=
mima
:
print
(
"登录成功"
)
if
name2
!=
name
and
mima2
=
mima
:
print
(
"用户名错误"
)
if
name2
=
name
and
mima2
!=
mima
:
print
(
"密码错误"
)
if
name2
!=
name
and
mima2
!=
mima
:
print
(
"密码和用户名错误"
)
\ 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