1. 实现需求为 注册、登录、查看昵称的功能

 def userN():
     username = input("请输入账号: \n")
     password = input('请输入密码: \n')
     return username,password


 def register():
     # 注册函数封装
     username,password= userN()
     temp = username + "|" + password
     with open('D:\Test_Python\login.md','w') as file:
         file.write(temp)


 def login():
     # 登录函数封装
     username,password= userN()
     with open('D:\Test_Python\login.md') as file:
         user = file.read().split("|")
     if username == user[0] and password == user[1]:
         return '登录成功'
     else:
         return '登录失败,请检查账号或者密码'

 def getNick(func):
     # 查看个人主页
     with open('D:\Test_Python\login.md') as file:
         user = file.read().split("|")
     if func:
         print('{}您好,欢迎再次回来!'.format(user[0]))
     else:
         print('您为进行登录,请登录!')

 def exit():
     # 退出系统
     import sys
     print('系统已退出,欢迎下次再登录!')
     sys.exit(1)
    

 def Main():
     while True:
         put = int(input('请选择 1.注册 2.登录 3.退出系统'))
         if put == 1:
             register()
         elif put == 2:
             getNick(login())
         elif put == 3:
             exit()
         else:
             print('输入错误,请重新输入...')
             continue


 if __name__ == '__main__':
     Main()

2. 列表a = [1,2,3,4,5,6,7],将列表a的值赋给列表b,在不影响列表a的情况下,将列表b的值每间隔一个元素替换成6

'''
遇到问题没人解答?小编创建了一个Python学习交流QQ群:531509025
寻找有志同道合的小伙伴,互帮互助,群里还有不错的视频学习教程和PDF电子书!
'''
 import copy
 a = [1,2,3,4,5,6,7]
 b = a[:]
 items = len(b)
 for i in range(1,items):
     # print(i)
     if i%2==0:
         # print(i)
         b[i] = 6
 print(a)
 print(b)
 [1, 2, 3, 4, 5, 6, 7]
 [1, 2, 6, 4, 6, 6, 6]

3.让用户输入用户密码,成功打印欢迎信息,输错提示还剩几次机会,三次机会仍然错误退出程序

 times = 3
 while times>0:
     user = input('请输入用户名:')
     pwd = input('请输入密码:')
     if user =='admin' and pwd =='admin':
         print('欢迎进入KZ系统')
         if times != 0:
             print('您还剩'+str(times-1)+'次机会')
         else:
             pass
     else:
         if user == 'Admin' and pwd == '':
             print('密码错误')
             if times != 0:
                 print('您还剩'+str(times-1)+'次机会')
             else:
                 pass
         else:
            print('输入有误')
             if times != 0:
                 print('您还剩'+str(times-1)+'次机会')
                 # continue
             else:
                 break
     times -= 1