Пример #1
0
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('只能输入数字')
Пример #2
0
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('只能输入数字')