def check_course_student(): while True: print('---查看课程下学生---') # 打印老实的课程列表-->选择课程-->查看课程下的学生 flag, course_list = teacher_interface.check_course( teacher_info['user']) if not flag: print(course_list) break # 打印课程列表 for index, course_name in enumerate(course_list): print(index, course_name) choice = input('请输入课程编号:').strip() if not choice.isdigit(): continue choice = int(choice) if choice not in range(len(course_list)): continue # 获取了课程名称 course_name = course_list[choice] # 调用接口,获取课程下的学生列表 flag, student_list = teacher_interface.check_student( course_name, teacher_info['user']) if flag: print(student_list) break else: print(student_list) break
def check_course(): print('查看教授课程') course_list = teacher_interface.check_course(teacher_info['name']) if not course_list: print('您暂无教授课程,请去选择教授课程') return for course in course_list: print(course)
def check_course(): while True: print('---教授课程---') flag, course_list = teacher_interface.check_course( teacher_info['user']) if flag: print(course_list) break else: print(course_list) break
def modify_score(): print('修改成绩') while True: course_list = teacher_interface.check_course(teacher_info['name']) if not course_list: print('您暂无教授的课程,请先选择教授课程') break for i, course in enumerate(course_list): print('%s : %s' % (i, course)) choice = input('请选择要查看的课程').strip() if choice.isdigit(): choice = int(choice) if choice >= 0 and choice < len(course_list): student_list = teacher_interface.check_student_by_course( course_list[choice]) if not student_list: print('该课程下暂无学生') break for i, student in enumerate(student_list): print('%s : %s' % (i, student)) choice_student = input('请选择要修改的学生').strip() if choice_student.isdigit(): choice_student = int(choice_student) if choice_student >= 0 and choice_student < len( student_list): print('选择了学生:%s' % student_list[choice_student]) score = input('请输入要修改的分数:').strip() if score.isdigit(): score = int(score) # teacher_name,student_name,course_name,score teacher_interface.change_student_scour( teacher_info['name'], student_list[choice_student], course_list[choice], score) break else: print('只能输入数字') else: print('请选择存在的课程') else: print('只能输入数字')
def check_student(): print('查看课程下学生') course_list = teacher_interface.check_course(teacher_info['name']) if not course_list: print('您暂无教授课程,请先选择课程') return for i, course in enumerate(course_list): print('%s : %s' % (i, course)) choice = input('请选择要查看的课程').strip() if choice.isdigit(): choice = int(choice) if choice >= 0 and choice < len(course_list): student_list = teacher_interface.check_student_by_course( course_list[choice]) for i, student in enumerate(student_list): print('%s : %s' % (i, student)) else: print('请选择存在的课程') else: print('只能输入数字')
def change_score(): while True: # 获取老师中所有的课程,并选择 flag, course_list_or_msg = teacher_interface.check_course( teacher_info['user']) if not flag: print(course_list_or_msg) break # 通过课程查看课程中所有的学生 for index, course_name in enumerate(course_list_or_msg): print(index, course_name) choice = input('请输入课程编号:').strip() 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_student( course_name, teacher_info['user']) if not flag: print(student_list) break # 先循环打印所有的学生,并选择学生编号,获取学生姓名 for index, student_name in enumerate(student_list): print(index, student_name) choice2 = input('请输入学生编号:').strip() 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('请输入修改的分数:').strip() # 课后作业1,校验修改的分数是否是数字 # if not score.isdigit(): # print('输入不规范,输入数字!') # continue score = int(score) # 课后作业2,校验输入的成绩是否 >100 # if score < 0 or score > 100: # print('输入不规范,输入正确范围!') # continue # 调用修改学生分数接口 flag, msg = teacher_interface.change_score(student_name, course_name, score, teacher_info['user']) if flag: print(msg) break