###############简易的登录程序#############
# def login(username,pwd):
# '''
#登录
# :param username:
# :param pwd:
# :return:
# '''
# with open('db', 'r', encoding='utf-8') as f:
# for line in f:
# line = line.strip()
# line_list = line.split('$')
# if line_list[0] == username and line_list[1] == pwd:
# #print('login success!')
# return True
# return False
#
# def register(username,pwd):
# '''
# register
# :param usrname:
# :param pwd:
# :return:
# '''
# with open('db', 'a', encoding='utf-8') as f:
# temp = '\n' + username + '$' + pwd
# f.write(temp)
# return True
#
# def exist(username):
# with open('db', 'r', encoding='utf-8') as f:
# for line in f:
# line = line.strip()
# line_list = line.split('$')
# if line_list[0] == username:
# return True
# return False
#
# inp = input('1,login 2,register : ')
# if inp =='1':
# inp_user = input('username : ')
# inp_pwd = input('pwd : ')
# if login(inp_user, inp_pwd):
# print('login success!')
# else:
# print('login fail')
# elif inp =='2':
# inp_user = input('username : ')
# inp_pwd = input('pwd : ')
# if exist(inp_user):
# print('user exist! register fail!')
# elif register(inp_user,inp_pwd):
# print('register success!')
# else:
# print('input error')
#冒泡排序
#list1 = [11,22,3,4,35,68,34,88,79]
# def mysort(list):
# for i in range(len(list)):
# for j in range(len(list)-i-1):
# if list[j] > list[j+1]:
# list[j],list[j+1] = list[j+1],list[j]
# return list
#
# inp = input('input your list :')
# inp_list = inp.split(',')
# for i in range(len(inp_list)):
# inp_list[i] = int(inp_list[i])
# list_new = mysort(inp_list)
# print(list_new)
#递归:斐波拉契数列
print('==================================')
defFibonacci(depth,a1,a2):
#print(depth)
'''
:paramdepth:深度,从第几层开始找
:parama1:起始值1
:parama2:起始值2
:return:深度到10返回a1,通过i传回第一层调用者
'''
ifdepth ==10:
returna1
print(a1)
a3 = a1 + a2
i = Fibonacci(depth+1,a2,a3)
returni
Fi = Fibonacci(1,,1)
print(Fi)
领取专属 10元无门槛券
私享最新 技术干货