Commit 313ed1d0 by BellCodeEditor

auto save

parent 4e99a0e0
Showing with 47 additions and 15 deletions
username = "python"
userpassword = "123456"
while True:
name = input("请输入用户名:")
password = input("请输入密码:")
if name == username and password == userpassword:
print("登录成功!")
break
if name != username:
print("用户名错误,请重新输入!")
continue
if password != userpassword:
print("密码输入有误,请重新输入!")
print("欢迎来到贝尔编程!")
\ No newline at end of file
# username = "python"
# userpassword = "123456"
# i = 3
# while True:
# name = input("请输入用户名:")
# password = input("请输入密码:")
# i-=1
# if i > 0:
# if name == username and password == userpassword:
# print("登录成功!")
# break
# if name != username:
# print("用户名错误,请重新输入!")
# print("温馨提示:您还有"+str(i)+"次机会")
# 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("输入有误请重新输入")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment