def check_course_student(): while True: # 打印老师教授的课程,并让老师选择 flag, course_list = teacher_interface.check_teach_course_interface( teacher_info.get('user')) if not flag: print(course_list) else: print('教授课程有') for index, course_name in enumerate(course_list): print(f'课程编号:{index}\t课程名称:{course_name.rstrip(".pk")}') choice = input('输入你选择的编号:').strip() if choice.isdigit(): choice = int(choice) if choice in range(len(course_list)): student_list = teacher_interface.check_course_student_interface( teacher_info.get('user'), course_list[choice].rstrip('.pk')) if student_list: print(f'{course_list[choice]}课程下的学生有:') for student_name in student_list: print(f'{student_name}\t', end='') break else: print('该课程下没有学生!') break else: print('输入正确的课程编号!')
def check_teach_course(): flag, msg = teacher_interface.check_teach_course_interface( teacher_name.get('user')) if flag: print(msg) else: print(msg)
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_course_student(): print(f'{"*"*11}欢迎来到查看课程学生功能{"*"*11}') while True: flag, course_msg = teacher_interface.check_teach_course_interface( teacher_info['username']) if not flag: print('没有课程') for index, course in enumerate(course_msg): print(index, course) choice_course = input('请输入课程编号,q退出>').strip() if choice_course == 'q': break if not choice_course.isdigit(): print('请输入编号') continue choice_course = int(choice_course) if choice_course not in range(len(course_msg)): print('请输入正确编号') continue course_name = course_msg[choice_course] # print(course_name) # 调用查看课程下学生接口 flag, student_list = teacher_interface.check_course_student_interface( teacher_info['username'], course_name) if flag: print(student_list) break else: print(student_list) break
def check_teach_course(): print(f'{"*"*11}欢迎来到查看教授课程功能{"*"*11}') flag, msg = teacher_interface.check_teach_course_interface( teacher_info['username']) if flag: print(msg) else: print(msg)
def check_teach_course(): flag, course_list_or_msg = teacher_interface.check_teach_course_interface( teacher_info.get('user')) if flag: print('教授的课程有:') for course_name in course_list_or_msg: print(f'{course_name}\t', end='') else: print(course_list_or_msg)
def correct_student_course(): correct_stu_score_course_name = '' while True: # 获取老师教的所有课程并打印,让老师选择一门课程 flag, course_list_or_msg = teacher_interface.check_teach_course_interface( teacher_info.get('user')) if flag: for index, course_name in enumerate(course_list_or_msg): print(f'课程编号{index}\t课程名称{course_name}') choice = input('选择你的课程编号:').strip() if choice.isdigit(): choice = int(choice) correct_stu_score_course_name = course_list_or_msg[choice] else: print('请重新输入!') continue else: print(course_list_or_msg) continue # 从老师选择的课程中打印出所有学生,让老师选择一位更改 student_list = teacher_interface.check_course_student_interface( teacher_info.get('user'), correct_stu_score_course_name) print(f'{correct_stu_score_course_name}课程中学生姓名:') for index, student_name in enumerate(student_list): print(f'编号:{index}\t姓名{student_name}') choice = input('输入你要修改的学生编号:').strip() if choice.isdigit(): score = input('输入你要修改的分数:').strip() if score.isdigit(): score = int(score) if score in range(0, 101): choice = int(choice) if choice in range(len(student_list)): flag, msg = teacher_interface.correct_student_course_interface( # 学生姓名 # 课程名字 老师姓名 student_list[choice], correct_stu_score_course_name, teacher_info.get('user'), score) if flag: print(msg) break else: print('修改失败') else: print('请输入正确编号') else: print('输入0~100的数字') else: print('输入数字')
def change_score(): print(f'{"*"*13}欢迎来到修改学生成绩功能{"*"*13}') while True: # 获取当前老师下所有的课程 flag, course_list_or_msg = teacher_interface.check_teach_course_interface( teacher_info['username']) if not flag: print('没有课程') break for index, course in enumerate(course_list_or_msg): print(index, course) choice = input('请选择课程编号,q退出>').strip() if choice == 'q': break if not choice.isdigit(): print('请输入正确的编号>') continue choice = int(choice) if choice not in range(len(course_list_or_msg)): print('请输入正确的编号>') continue course_name = course_list_or_msg[choice] # 找课程下的学生,若有学生,则循环打印学生列表,让老师选择学生 flag, student_list = teacher_interface.check_course_student_interface( teacher_info['username'], course_name) if not flag: print('该课程下没有学生') break for index, student in enumerate(student_list): print(index, student) choice1 = input('请选择学生编号,q退出>').strip() if choice1 == 'q': break if not choice1.isdigit(): print('请输入正确的编号>') continue choice1 = int(choice1) if choice1 not in range(len(student_list)): print('请输入正确的编号>') continue student_name = student_list[choice1] # 输入修改学生的成绩 score = input('请输入修改的成绩>').strip() flag, msg = teacher_interface.change_score_interface( teacher_info['username'], course_name, student_name, score) if flag: print(msg)
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