def check_teach_student(): while 1: flag, msg = teacher_interface.check_teach_course_interface( teacher_name.get('user')) if not flag: print(msg) break for index, course_name in enumerate(msg): print(f'编号:{index} 课程名:{course_name}') cmd = input('请选择课程编号:').strip() if not cmd.isdigit(): print('请输入数字!!') continue cmd = int(cmd) if cmd not in range(len(msg)): print('请输入正确的编号!!') continue course_name = msg[cmd] flag1, msg1 = teacher_interface.check_student_interface( course_name, teacher_name.get('user')) if flag1: print(msg1) break else: print(msg1)
def check_student(): print('欢迎查看学生') while True: teacher_name = user_info['username'] course_list = teacher_interface.check_course_interface(teacher_name) if not course_list: print('请先增加课程') continue for i, course in enumerate(course_list): print(i, course) choice = input('请选择你需要的课程>>>').strip() if choice == 'q': break if not choice.isdigit(): print('请输入数字') continue choice = int(choice) if choice not in range(len(course_list)): print('输入错误') continue course_name = course_list[choice] student_list = teacher_interface.check_student_interface(course_name) if not student_list: print('暂无学生') print(student_list) break
def check_student(): while True: course_list = teacher_interface.check_course_interface( teacher_auth.get('username')) if not course_list: print('没有课程可供选择') break for k, v in enumerate(course_list): print(k, v) choice1 = input('请输入课程编号:') if not choice1.isdigit(): print('请输入数字') continue choice1 = int(choice1) if choice1 not in range(len(course_list)): continue student_list = teacher_interface.check_student_interface( course_list[choice1]) if not student_list: print('没有学生') break print(student_list) choice2 = input('按q退出,或者任意键继续:') if choice2 == 'q': break
def check_student(): while True: flag, course_list = teacher_interface.check_course_interface( teacher_info['user']) if not flag: print(course_list) break else: for i, course in enumerate(course_list): print(f'{i}:{course}') choice = input('选择课程编号:') if choice == 'q': break if not choice.isdigit(): print('必须是数字 !') continue choice = int(choice) if choice not in range(len(course_list)): print('没有这个课程!') continue course_name = course_list[choice] flag, msg = teacher_interface.check_student_interface( teacher_info['user'], course_name) print(msg) break
def check_student_in_course(): print("查看课程下的学生界面".center(30, '-')) while True: # 获取所授课程 flag, course_list = teacher_interface.check_course_interface(teacher_info['name']) if not flag: print(course_list) break print('=' * 30) for index, course in enumerate(course_list): print('编号:%s 课程:%s' % (index, course)) print('=' * 30) choice = input("请输入课程编号:") if not choice.isdigit(): print("请输入数字!") continue choice = int(choice) if not (choice >= 0 and choice < len(course_list)): print("请输入合法编号!") continue course_name = course_list[choice] msg = teacher_interface.check_student_interface(teacher_info['name'], course_name) if not msg: print("课程下没有学生!") break print(msg) break
def change_score(): while True: #1、获取当前老师下的所有课程 flag,teacher_course_list=teacher_interface.check_course_interface( teacher_info.get('user') ) if not flag: print('该老师下没有课程!') break #有课程的老师,循环打印老师的课程列表 for index,course in enumerate(teacher_course_list): print(index,course) choice = input('请选择课程编号:').strip() if not choice.isdigit(): continue choice=int(choice) if choice not in range(len(teacher_course_list)): continue course_name = teacher_course_list[choice] #查看老师对应课程下的学生情况 flag,student_list=teacher_interface.check_student_interface( teacher_info.get('user'),course_name ) if not flag: print('没有学生') break #如果有学生,则循环打印学生列表,让老师选择学生 for index,student_name in enumerate(student_list): print(index,student_name) #老师选择学生编号 choice2=input('请选择学生编号:').strip() if not choice2.isdigit(): continue choice2 =int(choice2) if choice2 not in range(len(student_list)): continue student_name = student_list[choice2] #请输入修改学生的成绩 score=input('请输入修改的成绩:').strip() flag,msg=teacher_interface.change_score_interface( teacher_info.get('user'),course_name,student_name,score ) if flag: print(msg) break
def change_score(): print('欢迎修改分数') while True: teacher_name = user_info['username'] course_list = teacher_interface.check_course_interface(teacher_name) if not course_list: print('请先增加课程') continue for i, course in enumerate(course_list): print(i, course) choice = input('请选择你需要的课程>>>').strip() if choice == 'q': break if not choice.isdigit(): print('请输入数字') continue choice = int(choice) if choice not in range(len(course_list)): print('输入错误') continue course_name = course_list[choice] student_list = teacher_interface.check_student_interface(course_name) for i, student in enumerate(student_list): print(i, student) choice2 = input('请选择学生编号>>>').strip() if choice2 == 'q': break if not choice2.isdigit(): print('请输入数字') continue choice2 = int(choice2) if choice2 not in range(len(student_list)): print('输入错误') continue student_name = student_list[choice2] score = input('请输入你需要修改的分数>>>') msg = teacher_interface.change_score_interface(teacher_name, course_name, student_name, score) print(msg) break
def change_score(): while True: # 1.获取当前老师下所有的课程 flag, course_list_or_msg = teacher_interface.check_course_interface( teacher_info.get('user')) if not flag: print('老师下没有课程') break for index, course in enumerate(course_list_or_msg): print(index, course) choice = input('请选择课程编号:').strip() if not choice.isdigit(): continue choice = int(choice) if choice not in range(len(course_list_or_msg)): continue course_name = course_list_or_msg[choice] flag, student_list_or_msg = teacher_interface.check_student_interface( teacher_info.get('user'), course_name) # 若有学生,则循环打印学生列表,让老师选择学生 if not flag: print(student_list_or_msg) break for index, student in enumerate(student_list_or_msg): print(index, student) choice2 = input('请选择学生编号:').strip() if not choice2.isdigit(): continue choice2 = int(choice2) if choice2 not in range(len(student_list_or_msg)): continue student_name = student_list_or_msg[choice2] # 输入修改学生的成绩 score = input('请输入修改的成绩:').strip() flag, msg = teacher_interface.change_score_interface( teacher_info.get('user'), course_name, student_name, score) if flag: print(msg) break
def change_score(): while True: flag, course_list = teacher_interface.check_course_interface( teacher_info['user']) if not flag: print(course_list) break else: for i, course in enumerate(course_list): print(f'{i}:{course}') choice = input('选课程编号:') if choice == 'q': break if not choice.isdigit(): print('必须是数字 !') continue choice = int(choice) if choice not in range(len(course_list)): print('没有这个学校!') continue course_name = course_list[choice] flag, student_list = teacher_interface.check_student_interface( teacher_info['user'], course_name) if not flag: print(student_list) break else: for i, student in enumerate(student_list): print(f'{i}:{student}') choice = input('选择学校编号:') if choice == 'q': break if not choice.isdigit(): print('必须是数字 !') continue choice = int(choice) if choice not in range(len(student_list)): print('没有这个学校!') continue student_name = student_list[choice] score = input('输入修改的成绩分数:') if int(score) > 100 or not score.isdigit(): print('成绩输入错误 !') continue flag, msg = teacher_interface.change_score_interface( teacher_info['user'], student_name, course_name, score, ) print(msg) if flag: break
def modify_score_of_student(): ''' 1、打印老师下面的所有课程 2、选择某一门课程下的某个学生,打印 3、设置成绩 ''' print("修改分数界面".center(30, '-')) while True: # 获取所授课程 flag, course_list = teacher_interface.check_course_interface(teacher_info['name']) if not flag: print(course_list) break print('=' * 30) for index, course in enumerate(course_list): print('编号:%s 课程:%s' % (index, course)) print('=' * 30) choice = input("请输入课程编号:") if not choice.isdigit(): print("请输入数字!") continue choice = int(choice) if not (choice >= 0 and choice < len(course_list)): print("请输入合法编号!") continue course_name = course_list[choice] student_list = teacher_interface.check_student_interface(teacher_info['name'], course_name) if not student_list: print("课程下没有学生!") break print('=' * 30) for i, student in enumerate(student_list): print('编号:%s 学生:%s' % (i, student)) print('=' * 30) choose = input("请输入学生编号:") if not choose.isdigit(): print("请输入数字!") continue choose = int(choose) if not (choose >= 0 and choose < len(student_list)): print("请输入合法编号!") continue student_name = student_list[choose] score = input("请输入分数:") flag, msg = teacher_interface.modify_score_interface(teacher_info['name'], student_name, course_name, score) if flag: print(msg) break
def check_student(): '''查看课程下的学生''' coures = teacher_interface.check_all_course_interface() if not coures: print('暂无课程') while True: for i, coure in enumerate(coures): print(i, ':', coure) num = input('请输入课程序号:').strip() if num == 'q': return if num.isdigit() and int(num) <= len(coures): students = teacher_interface.check_student_interface( coures[int(num)]) for student in students: print(student) else: print('输入有误,请重试')
def check_student(): while True: course_list = teacher_interface.check_course_interface(teacher_info.get('user')) if not course_list: print('暂无课程') break for course in course_list: print(course) choice = input('请选择你要查看的课程>>>').strip() if choice in course_list: course_name = choice flag,msg = teacher_interface.check_student_interface(teacher_info.get('user'),course_name) print(msg) if flag: break break else: print('请选择存在的课程')
def check_student(): """ 查看老师教授的课程下的学生 """ while True: # 1获取老师选择的课程 flag, course_list = teacher_interface.check_course_interface( teacher_info.get('user')) if not course_list: print("课程为空,请去选择课程") # 2 打印课程信息 for indx, course in enumerate(course_list): print(indx, course) # 3选择课程 choice = input("请输入编号") if choice == 'q': break if not choice.isdigit(): print("输入必须是数字") continue choice = int(choice) if choice not in range(len(course_list)): print("课程不存在") continue course_name = course_list[choice] # 4 选择课程 flag, msg = teacher_interface.check_student_interface( teacher_info.get('user'), course_name) if flag: print(msg) else: print(msg)
def check_student(): while True: # 1.获取老师下所有课程 flag, course_list_or_msg = teacher_interface.check_course_interface( teacher_info.get('user')) if not flag: print('没有课程') break for index, course in enumerate(course_list_or_msg): print(index, course) choice = input('请输入课程编号:').strip() if not choice.isdigit(): continue choice = int(choice) if choice not in range(len(course_list_or_msg)): continue course_name = course_list_or_msg[choice] # 调用查看课程下学生接口 flag, student_list_or_msg = teacher_interface.check_student_interface( teacher_info.get('user'), course_name) if flag: print(student_list_or_msg) break else: print(student_list_or_msg) break
def change_score(): while 1: flag, msg = teacher_interface.check_teach_course_interface( teacher_name.get('user')) if not flag: print(msg) break for index, course_name in enumerate(msg): print(f'编号:{index} 课程名:{course_name}') cmd = input('请选择课程编号:').strip() if not cmd.isdigit(): print('请输入数字!!') continue cmd = int(cmd) if cmd not in range(len(msg)): print('请输入正确的编号!!') continue course_name = msg[cmd] flag1, msg1 = teacher_interface.check_student_interface( course_name, teacher_name.get('user')) if not flag1: print(msg1) break for index1, stu_name in enumerate(msg1): print(f'编号:{index1} 学生名:{stu_name}') cmd1 = input('请选择学生编号:').strip() if not cmd1.isdigit(): print('请输入数字!') continue cmd1 = int(cmd1) if cmd1 not in range(len(msg1)): print('请输入正确的编号!!') continue stu_name = msg1[cmd1] score = input('请输入分数:').strip() if not score.isdigit(): print('请输入数字!') continue score = int(score) flag2, msg2 = teacher_interface.change_score_interface( course_name, stu_name, score, teacher_name.get('user')) if flag2: print(msg2) break
def change_score(): """ 修改课程成绩 """ while True: # 1 获取老师下面的课程 flag, course_list = teacher_interface.check_course_interface( teacher_info.get('user')) if not course_list: print("课程为空,请去选择课程") for indx, course in enumerate(course_list): print(indx, course) # 2选择课程 choice = input("请输入编号") if choice == 'q': break if not choice.isdigit(): print("输入必须是数字") continue choice = int(choice) if choice not in range(len(course_list)): print("课程不存在") continue course_name = course_list[choice] # 3获取课程下的学生 flag, student_list = teacher_interface.check_student_interface( teacher_info.get('user'), course_name) if not flag: print("课程下没有学生") for indx, student in enumerate(student_list): print(indx, student) # 4选择课程 choice2 = input("请输入编号") if choice2 == 'q': break if not choice2.isdigit(): print("输入必须是数字") continue choice2 = int(choice2) if choice2 not in range(len(student_list)): print("课程不存在") continue student_name = student_list[choice] score = input("请输入课程成绩") # 5 修改成绩接口 flag, msg = teacher_interface.change_score_interface( teacher_info.get('user'), course_name, student_name, score) if flag: print(msg) else: print(msg)