Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-2_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
0e206bc6
authored
Jun 19, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
1cada8c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
45 deletions
aaa.py
diy1.py
aaa.py
View file @
0e206bc6
import
turtle
un
=
"cao"
h
=
turtle
.
Screen
()
ud
=
"bowen"
h
.
bgcolor
(
"yellow"
)
n
=
input
(
"用户名"
)
c
=
h
.
textinput
(
"提示"
,
"你想要多大的爱心呀?"
)
p
=
input
(
"密码"
)
b
=
int
(
c
)
\ No newline at end of file
p
=
turtle
.
Pen
()
p
.
up
()
p
.
goto
(
100
,
100
)
p
.
down
p
.
write
(
"你被多米尼加蒂芬用M1A1卡宾枪击杀了"
,
font
=
(
"楷体"
,
10
,
"normal"
))
p
.
hideturtle
()
w
=
turtle
.
Pen
()
w
.
pencolor
(
"blue"
)
w
.
pensize
(
10
)
w
.
left
(
45
)
w
.
forward
(
2
*
b
)
w
.
circle
(
b
,
180
)
w
.
right
(
90
)
w
.
circle
(
b
,
180
)
w
.
forward
(
2
*
b
)
w
.
hideturtle
()
turtle
.
done
()
\ No newline at end of file
diy1.py
View file @
0e206bc6
un
=
cao
username
=
"cao"
ud
=
bowen
userpassword
=
"bowen"
n
=
input
(
"用户名"
)
while
True
:
p
=
input
(
"密码"
)
name
=
input
(
"请输入用户名:"
)
if
n
==
un
and
p
==
ud
password
=
input
(
"请输入密码:"
)
print
(
"登陆成功,开始游戏"
)
if
name
==
username
and
password
==
userpassword
:
p
=
input
(
"请出拳(剪刀=1/石头=2/布=3):"
)
print
(
"登录成功!"
)
print
(
"玩家出拳:"
+
p
)
break
import
random
if
name
!=
username
:
list
=
[
'2'
,
'1'
,
'3'
]
print
(
"用户名不存在,请重新输入!"
)
c
=
random
.
choice
(
list
)
if
password
!=
userpassword
:
print
(
"电脑出拳:"
+
c
)
print
(
"密码输入有误,请重新输入!"
)
if
p
in
list
:
print
(
"用户名和密码错误!请重新输入"
)
if
p
==
c
:
print
(
"进入游戏"
)
print
(
'平局'
)
\ No newline at end of file
elif
(
p
==
'2'
and
c
==
'1'
)
or
(
p
==
'1'
and
c
==
'3'
)
or
(
p
==
'3'
and
c
==
'2'
):
print
(
'你赢了'
)
else
:
print
(
'你输了'
)
else
:
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