def choose_school(): while True: school_list = common_interface.get_school_interface() for index, school in enumerate(school_list): print(index, school) choice = input('请输入选择的学校编号:').strip() #如果不是数字 if not choice.isdigit(): print('必须是数字!') continue choice = int(choice) if choice not in range(len(school_list)): print('必须输入正确的学校编号:') continue school_name = school_list[choice] flag, msg = student_interface.choose_school_interface( student_info.get('user'), school_name) if flag: print(msg) break else: print(msg) break
def creat_course(): while True: flag,school_list = common_interface.get_school_interface() if not flag: print(school_list) break else: for i,school in enumerate(school_list): print(f'{i}:{school}') choice = input('选择学校编号:') if choice == 'q': break if not choice.isdigit(): print('必须是数字 !') continue choice = int(choice) if choice not in range(len(school_list)): print('没有这个学校!') continue school_name = school_list[choice] course_name = input('输入课程名:') flag,msg = admin_interface.creat_course_interface(admin_info['user'],school_name,course_name) print(msg) if flag: break
def choose_school(): print(f'{"*"*13}欢迎来到选择学校功能{"*"*13}') while True: school_list = common_interface.get_school_interface() if not school_list: print('没有学校请先创建学校') break # 2.选择学校 for index, school in enumerate(school_list): print(index, school) choice_school = input('请输入学校编号,q退出>') if choice_school == 'q': break if not choice_school.isdigit(): print('请输入数字') continue choice_school = int(choice_school) if choice_school not in range(len(school_list)): print('输入错误!') continue school_name = school_list[choice_school] flag, msg = student_interface.choose_school_interface( student_info['username'], school_name) if flag: print(msg) break else: print(msg)
def create_course(): print(f'{"*"*13}欢迎来到创建课程功能{"*"*13}') while True: # 1.获取所有的学校 school_list = common_interface.get_school_interface() if not school_list: print('没有学校请先创建学校') break # 2.选择学校 for index, school in enumerate(school_list): print(index, school) choice_school = input('请输入学校编号>') if not choice_school.isdigit(): print('请输入数字') continue choice_school = int(choice_school) if choice_school not in range(len(school_list)): print('输入错误!') continue # 3.添加课程给学校 school_name = school_list[choice_school] course_name = input('请输入课程名称,q退出>').strip() if course_name == 'q': break flag, msg = admin_interface.create_course_interface( admin_info['username'], school_name, course_name) if flag: print(msg) else: print(msg)
def choose_school(): while True: school_list = common_interface.get_school_interface() for school in school_list: print(school) choice = input('请选择学校>>>').strip() if choice in school_list: school_name = choice flag,msg = student_interface.choose_school_interface(student_info['user'],school_name) print(msg) if flag: break else: print('请选择存在的学校') continue
def creat_course(): while True: school_list = common_interface.get_school_interface() if not school_list: print('没有学校,请去创建') break for school in school_list: print(school) choice = input('请选择学校>>>').strip() if choice in school_list: school_name = choice course_name = input('请输入课程名称>>>').strip() flag, msg = admin_interface.creat_course(admin_info.get('user'), school_name, course_name) print(msg) if flag: break else: print('请输入存在的学校')
def create_course(): while True: # 1.获取所有的学校 # [s1, s2...] or None school_list = common_interface.get_school_interface() if not school_list: print('没有学校,请去创建!') break for index, school in enumerate(school_list): print(index, school) # 2.选择学校 choice = input('请选择学校编号:').strip() if not choice.isdigit(): print('请输入数字') continue choice = int(choice) if choice not in range(len(school_list)): print('输入有误!') continue # 3.添加课程给学校 school_name = school_list[choice] course_name = input('请输入课程名称: ').strip() flag, msg = admin_interface.create_course_interface( admin_info.get('user'), school_name, course_name) if flag: print(msg) break else: print(msg)