2019-08-06 day12作业

regiser.py
from setting import *
from file_teacher import *


def login():
  account = input('请输入账号:')
  password = input('请输入密码:')
  is_login = False
  user = get_teacher_name()
  if account in user.keys():
      if password == user[account]:
          is_login = True
          print('登录成功')
      else:
          print('登录失败,密码错误')
  else:
      print('登录失败,该账号没有注册')

  index_login(is_login)


def register():
  while True:
      name = input('请输入姓名(3-6位):')
      if not 3 <= len(name) <= 6:
          print('你输入的姓名长度不符合要求')
      elif get_teacher_name():
          user = get_teacher_name()
          if name in user.keys():
              print('你输入的名字已经被注册')
          else:
              break
      else:
          break
  while True:
      pwd = input('请输入密码(6-10位):')
      if not 6 <= len(pwd) <= 10:
          print('你输入的密码长度不符合要求')
      else:
          break
  if file_register(name, pwd):
      print('注册成功')
      index_login()
  else:
      print('注册失败')


def choose_menu():
  choose_num = int(input('请选择(1-3):'))
  if choose_num == 1:
      login()
  elif choose_num == 2:
      register()
  elif choose_num == 3:
      pass
  else:
      choose_menu()


def index_login(is_login=False) -> bool:
  print(top)
  print(top_2)
  if is_login:
      return True
  else:
      print(hint_1)
      print(hint_2)
      print(hint_3)
      print(bottom)
      choose_menu()
      return False

index_login

你可能感兴趣的:(2019-08-06 day12作业)