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
313ed1d0
authored
May 22, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
4e99a0e0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
15 deletions
test.py
test.py
View file @
313ed1d0
username
=
"python"
# username = "python"
userpassword
=
"123456"
# userpassword = "123456"
while
True
:
# i = 3
name
=
input
(
"请输入用户名:"
)
# while True:
password
=
input
(
"请输入密码:"
)
# name = input("请输入用户名:")
if
name
==
username
and
password
==
userpassword
:
# password = input("请输入密码:")
print
(
"登录成功!"
)
# i-=1
break
# if i > 0:
if
name
!=
username
:
# if name == username and password == userpassword:
print
(
"用户名错误,请重新输入!"
)
# print("登录成功!")
continue
# break
if
password
!=
userpassword
:
# if name != username:
print
(
"密码输入有误,请重新输入!"
)
# print("用户名错误,请重新输入!")
print
(
"欢迎来到贝尔编程!"
)
# print("温馨提示:您还有"+str(i)+"次机会")
\ No newline at end of file
# continue
# if password != userpassword:
# print("密码输入有误,请重新输入!")
# print("温馨提示:您还有"+str(i)+"次机会")
# continue
# else:
# print("机会已经达到上限")
# exit()
# print("欢迎来到贝尔编程!")
# month=int(input('请输入月份:'))
# if month==1 or month==2: #前两个月没有长大,没有规律,所以单拿出来
# print('一共有1只兔子')
# else:
# a=1 #第一个月
# b=1 #第二个月
# c=0 #一会求和用的变量,需要提前使其为0
# for i in range(3,month + 1): #因为1,2月的已经说明,所以从三月开始
# c=a+b #第n个月等于第n-1个月+第n-2个月
# a=b #将n-2=n-1
# b=c #将n-1=n
# print(c)
month
=
input
(
"请输入月份:"
)
if
month
.
isdigit
():
month
=
int
(
month
)
a
=
0
b
=
1
for
i
in
range
(
month
-
1
):
a
,
b
=
b
,
a
+
b
print
(
"
%
d月份以后兔子有
%
d对"
%
(
month
,
b
))
else
:
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