Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson4_4
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
620e7cd9
authored
Feb 05, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
3026e69a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
.py
1.py
.py
View file @
620e7cd9
i
=
3
username
=
"python"
userpassword
=
"123456"
while
True
:
if
i
>
0
:
name
=
input
(
"请输入用户名:"
)
password
=
input
(
"请输入密码:"
)
i
-=
1
if
name
==
username
and
password
==
userpassword
:
print
(
"登陆成功!"
)
break
elif
name
!=
username
:
print
(
"用户名输入错误!请重新输入!"
)
print
(
"温馨提示:您还有"
+
str
(
i
)
+
"次登陆机会"
)
else
:
print
(
"密码输入错误!请重新输入!"
)
print
(
"温馨提示:您还有"
+
str
(
i
)
+
"次登陆机会"
)
else
:
print
(
"你的账户已被锁定,请一小时后再来"
)
exit
()
print
(
"欢迎来到贝尔编程!"
)
\ No newline at end of file
try
:
age
=
int
(
input
(
'你今年几岁了?'
))
except
:
print
(
'要输入整数呀'
)
else
:
if
age
<
18
:
print
(
'不可以喝酒噢'
)
print
(
'程序结束~~'
)
\ No newline at end of file
1.py
View file @
620e7cd9
...
...
@@ -5,6 +5,12 @@ def new_input():
if
unit
==
'q'
:
break
else
:
total
.
append
(
unit
)
try
:
unit
=
int
(
unit
)
except
:
print
(
'请重新输入一个数字'
)
else
:
total
.
append
(
unit
)
print
(
'-'
*
30
)
print
(
total
)
new_input
()
\ 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