Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson4_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
2c6e42e8
authored
Sep 13, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
6daac40b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
0 deletions
login_2.py
login_3.py
score.py
login_2.py
0 → 100644
View file @
2c6e42e8
name
=
"python"
password
=
"111"
i
=
3
while
True
:
if
i
>
0
:
username
=
input
(
"请输入账号:"
)
userpassword
=
input
(
"请输入密码:"
)
i
-=
1
if
username
==
name
and
userpassword
==
password
:
print
(
"登录成功"
)
break
else
:
if
username
!=
name
:
print
(
"账号输入错误"
)
print
(
"您还有"
+
str
(
i
)
+
"次机会"
)
continue
if
userpassword
!=
password
:
print
(
"密码输入错误"
)
print
(
"您还有"
+
str
(
i
)
+
"次机会"
)
else
:
print
(
"没机会了"
)
exit
()
print
(
"欢迎来到贝尔编程"
)
\ No newline at end of file
login_3.py
0 → 100644
View file @
2c6e42e8
name
=
"python"
password
=
"111"
i
=
3
while
True
:
if
i
>
0
:
username
=
input
(
"请输入账号:"
)
userpassword
=
input
(
"请输入密码:"
)
i
-=
1
if
username
==
name
and
userpassword
==
password
:
print
(
"登录成功"
)
break
else
:
if
username
!=
name
:
print
(
"账号错误"
)
print
(
"您还有"
+
str
(
i
)
+
"次机会"
)
continue
if
userpassword
!=
password
:
print
(
"密码错误"
)
print
(
"您还有"
+
str
(
i
)
+
"次机会"
)
else
:
print
(
"机会没了"
)
exit
()
print
(
"欢迎来到贝尔编程"
)
score.py
0 → 100644
View file @
2c6e42e8
import
random
s
=
0
while
True
:
p
=
input
(
"玩家出拳:"
)
list
=
[
"剪刀"
,
"石头"
,
"布"
]
c
=
random
.
choice
(
list
)
if
p
in
list
:
print
(
"玩家出拳"
+
p
)
print
(
"计算机出拳"
+
c
)
if
p
==
c
:
print
(
"平局"
)
elif
(
p
==
"石头"
and
c
==
"剪刀"
)
or
(
p
==
"剪刀"
and
c
==
"布"
)
or
(
p
==
"布"
and
c
==
"石头"
):
print
(
"玩家赢"
)
s
+=
1
else
:
print
(
"你输了"
)
s
-=
1
continue
if
p
==
"q"
or
p
==
"Q"
:
break
else
:
print
(
"请正确输入"
)
if
s
>
0
:
print
(
"恭喜你赢了"
+
str
(
s
)
+
"分"
)
else
:
print
(
"很遗憾你输了"
+
str
(
s
)
+
"分"
)
print
(
"游戏结束"
)
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