コード例 #1
0
def modify_score():
    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)
        course_choice = input('请选择课程>>>').strip()
        if course_choice in course_list:
            course_name = course_choice
            course = teacher_interface.get_course_interface(course_name)
            student_list = course.student_list
            if not student_list:
                print('暂无学生')
                break
            for student in student_list:
                print(student)
            student_choice = input('请选择学生>>>').strip()
            if student_choice in student_list:
                student_name = student_choice
                score = input('请输入分数>>>').strip()
                flag,msg = teacher_interface.change_score_interface(teacher_info.get('user'),course_name,student_name,score)
                print(msg)
                if flag:
                    break
コード例 #2
0
def check_course():
    print("查看教授的课程界面".center(30, '-'))
    flag, msg = teacher_interface.check_course_interface(teacher_info['name'])
    if flag:
        print(msg)
    else:
        print(msg)
コード例 #3
0
ファイル: teacher.py プロジェクト: mtccvip/coursesystem
def check_stu_from_course():
    while True:
        #1.列出当前老师所有课程供老师选择
        flag, course_list_or_msg = teacher_interface.check_course_interface(
            teacher_info.get('user'))
        if not flag:
            print(course_list_or_msg)
            break

        for index, course_name in enumerate(course_list_or_msg):
            print(f'编号:{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]

        #2.列出选择的课程下所有学生
        flag, student_list_or_msg = teacher_interface.get_student_interface(
            course_name, teacher_info.get('user'))
        if flag:
            print(student_list_or_msg)
            break
        else:
            print(student_list_or_msg)
コード例 #4
0
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
コード例 #5
0
def check_course():
    flag, course_list = teacher_interface.check_course_interface(
        teacher_info['user'])
    if flag:
        print(course_list)
    else:
        print(course_list)
コード例 #6
0
ファイル: teacher.py プロジェクト: mazhen111/daima
def check_stu_from_course():
    while True:
        #查看教授的课程
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info.get("user"))
        if flag:
            print(course_list)
        else:
            print(course_list)
        for index, course_name in enumerate(course_list):
            print("编号%s,课程%s" % (index, course_name))
        choices = input("请输入编号").strip()
        if not choices.isdigit():
            print("请输入数字")
            continue
        choices = int(choices)
        if choices not in range(len(course_list)):
            print("请输入正确的编号")
            continue
        # 选择课程的名字
        course_name = course_list[choices]
        print(course_name)
        print(teacher_info.get("user"))
        flag2, student_list = teacher_interface.get_student_interface(
            course_name, teacher_info.get("user"))
        if flag2:
            print(student_list, "222")
            break
        else:
            print(student_list, "11")
            break
コード例 #7
0
ファイル: teacher.py プロジェクト: mazhen111/daima
def check_course():
    flag, course_list = teacher_interface.check_course_interface(
        teacher_info.get("user"))
    if flag:
        print(course_list)
    else:
        print(course_list)
コード例 #8
0
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
コード例 #9
0
def check_stu_from_course():
    while True:
        # 先列出老师的课程列表,查询对应的学生列表
        flag, course_list = teacher_interface.check_course_interface(teacher_info['user'])
        if not flag:
            print(course_list)
            break
        for index, course_name in enumerate(course_list):
            print(f'课程编号:{index}  课程名称:{course_name}')

        choice = input('请输入课程编号:').strip()
        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.get_stu_interface(course_name, teacher_info['user'])
        if flag:
            print(msg)
            break
        else:
            print(msg)
            break
コード例 #10
0
def check_stu_from_course():
    while True:
        # 1.先获取当前老师下所有的课程
        flag, course_list = teacher_interface.check_course_interface(teacher_info.get('user'))
        if not flag:
            print(course_list)
            break

        # 2.打印所有课程,并让老师选择
        for index, course_name in enumerate(course_list):
            print(f'编号:{index}    课程名:{course_name}')

        choice = input('请输入选择的课程编号:').strip()

        if not choice.isdigit():
            print('输入有误')
            continue

        choice = int(choice)

        if choice not in range(len(course_list)):
            print('输入编号有误!')
            continue

        # 3.获取选择的课程名称
        course_name = course_list[choice]

        # 4.利用当前课程名称获取所有学生
        flag2, studemt_list = teacher_interface.get_student_interface(course_name, teacher_info.get('user'))

        print(studemt_list)
        break
コード例 #11
0
def check_stu_from_course():
    while True:
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info['user'])
        if not flag:
            print(course_list)
            break
        for index, course_name in enumerate(course_list):
            print(f'课程编号为:[{index}], 课程名称为:[{course_name}]')
        choice = input('请输入选择的课程编号==>').strip()
        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.get_student_interface(
            course_name, teacher_info['user'])
        if flag:
            print(student_list)
            break
        else:
            print(student_list)
            break
コード例 #12
0
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
コード例 #13
0
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
コード例 #14
0
ファイル: teacher.py プロジェクト: mtccvip/coursesystem
def check_course():
    flag, msg = teacher_interface.check_course_interface(
        teacher_info.get('user'))
    if flag:
        print(msg)
    else:
        print(msg)
コード例 #15
0
ファイル: teacher.py プロジェクト: szk5043/python
def check_course():
    '''查看教授课程'''
    courses = teacher_interface.check_course_interface(teacher_status['user'])
    if courses:
        for i, coures in enumerate(courses):
            print(i, ':', coures)
    else:
        print('目前没有教授的课程')
コード例 #16
0
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
コード例 #17
0
ファイル: teacher.py プロジェクト: mazhen111/daima
def change_score_syudent():
    """
     1 先获取老师下的所有的课程,并选择
     2 获取选择老师科恒的学生
     3 调用接口修改学生成绩
    """
    while True:
        # 查看教授的课程
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info.get("user"))
        if flag:
            print(course_list)
        else:
            print(course_list)
        for index, course_name in enumerate(course_list):
            print("编号%s,课程%s" % (index, course_name))
        choices = input("请输入编号").strip()
        if not choices.isdigit():
            print("请输入数字")
            continue
        choices = int(choices)
        if choices not in range(len(course_list)):
            print("请输入正确的编号")
            continue
        # 选择课程的名字
        course_name = course_list[choices]
        print(course_name)
        print(teacher_info.get("user"))
        flag2, student_list = teacher_interface.get_student_interface(
            course_name, teacher_info.get("user"))
        if not flag2:
            print(student_list)
            break
        for index2, student_name in enumerate(student_list):
            print("编号%s, 学生名%s" % (index2, student_name))
        choices2 = input("请输入编号").strip()
        if not choices2.isdigit():
            print("请输入数字")
            continue
        choices2 = int(choices2)
        if choices2 not in range(len(student_list)):
            print("请输入正确的编号")
            continue
        # 选择课程的名字
        student_name = student_list[choices]
        #修改学生成绩
        score = input("请输入修改的成绩分数:").strip()
        if not score.isdigit():
            print("输入有误")
            continue
        score = int(score)
        #调用修改学生接口
        flag3, mag = teacher_interface.change_score_interface(
            student_name, score, course_name, teacher_info.get("user"))
        if flag3:
            print(mag)
            break
コード例 #18
0
def check_course():
    print('欢迎查看课程')

    username = user_info['username']
    msg = teacher_interface.check_course_interface(username)
    if not msg:
        print('暂无课程')
    else:
        print(msg)
コード例 #19
0
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
コード例 #20
0
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
コード例 #21
0
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
コード例 #22
0
ファイル: teacher.py プロジェクト: mtccvip/coursesystem
def change_score_from_student():
    #1.列出老师所有教授课程供老师选择
    while True:
        flag, course_list_or_msg = teacher_interface.check_course_interface(
            teacher_info.get('user'))
        if not flag:
            print(course_list_or_msg)
            break
        for index, course_name in enumerate(course_list_or_msg):
            print(f'编号:{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]

        #2.列出所选择课程下所有学生供老师选择
        flag2, student_list_or_msg = teacher_interface.get_student_interface(
            course_name, teacher_info.get('user'))
        if not flag2:
            print(student_list_or_msg)
            break
        for index2, student_name in enumerate(student_list_or_msg):
            print(f'编号:{index2} 学生姓名:{student_name}')

        choice2 = input('请输入你的选择:').strip()
        if not choice2.isdigit():
            print('输入有误')
            continue
        choice2 = int(choice2)

        if choice2 not in range(len(student_list_or_msg)):
            print('输入有误')
            continue
        student_name = student_list_or_msg[choice2]

        #3.调用所选择的学生的分数修改接口
        score = input('请输入你的分数:').strip()
        if not score.isdigit():
            print('输入有误')
            continue
        score = int(score)

        flag3, msg = teacher_interface.change_score_interface(
            course_name, student_name, score, teacher_info.get('user'))

        if flag3:
            print(msg)
        else:
            print(msg)
コード例 #23
0
def change_score_from_student():
    """
    # 1.先获取老师下所有的课程并选择
    # 2.获取课程下所有的学生,并选择修改的学生
    # 3.调用修改学生分数接口
    """
    while True:
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info['user'])
        if not flag:
            print(course_list)
            break
        for index, course_name in enumerate(course_list):
            print(f'课程编号为:[{index}], 课程名称为:[{course_name}]')
        choice = input('请输入选择的课程编号==>').strip()
        if not choice.isdigit():
            print('输入有误!')
            continue
        choice = int(choice)
        if choice not in range(len(course_list)):
            print('输入课程编号有误!')
            continue
        course_name = course_list[choice]

        flag2, student_list = teacher_interface.get_student_interface(
            course_name, teacher_info['user'])
        if not flag2:
            print(student_list)
            break
        for index, stu_name in enumerate(student_list):
            print(f'学生编号为:[{index}], 学校姓名为:[{stu_name}]')
        choice_stu = input('请输入学生编号==>').strip()
        if not choice_stu.isdigit():
            print('输入有误!')
            continue
        choice_stu = int(choice_stu)
        if choice_stu not in range(len(student_list)):
            print('输入学生编号有误!')
            continue
        stu_name = student_list[choice_stu]

        score = input('请输入修改的成绩==>').strip()
        if not score.isdigit():
            print('输入成绩有误!')
            continue
        score = int(score)
        flag3, msg = teacher_interface.change_score_interface(
            course_name, stu_name, score, teacher_info['user'])
        if flag3:
            print(msg)
            break

    pass
コード例 #24
0
def change_score_from_student():
    while True:
        # 先列出老师的课程列表,查询对应的学生列表
        flag, course_list = teacher_interface.check_course_interface(teacher_info['user'])
        if not flag:
            print(course_list)
            break
        for index, course_name in enumerate(course_list):
            print(f'课程编号:{index}  课程名称:{course_name}')

        choice = input('请输入课程编号:').strip()
        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.get_stu_interface(course_name, teacher_info['user'])
        if not flag:
            print(student_list)
            break
        for index, student_name in enumerate(student_list):
            print(f'学生编号:{index}   学生姓名:{student_name}')

        student_name = input('请输入学生编号:').strip()
        if not student_name.isdigit():
            print('请输入数字编号')
            continue
        student_name = int(student_name)

        if student_name not in range(len(student_list)):
            print('输入编号有误')
            continue

        student_name = student_list[student_name]
        score = input('请输入修改的分数').strip()
        score = int(score)

        flag, msg = teacher_interface.change_score(student_name, course_name, score, teacher_info['user'])
        if flag:
            print(msg)
            break
        else:
            print(msg)
コード例 #25
0
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
コード例 #26
0
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('请选择存在的课程')
コード例 #27
0
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)
コード例 #28
0
def choose_course():
    while True:
        schoolname = teacher_interface.check_school_interface(
            teacher_auth.get('username'))

        course_list = teacher_interface.check_course_interface(schoolname)
        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
        msg = teacher_interface.choose_course_interface(
            course_list[choice1], teacher_auth.get('username'))
        print(msg)
        choice2 = input('按q退出,或者任意键继续:')
        if choice2 == 'q':
            break
コード例 #29
0
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
コード例 #30
0
def change_score_from_stu():
    '''
     1.先获取老师下所有的课程,并选择
     2.获取选择的课程下所有的学生,并选择修改的学生
     3.调用修改学生分数接口修改分数
    '''
    while True:
        # 1.先获取当前老师下所有的课程
        flag, course_list = teacher_interface.check_course_interface(teacher_info.get('user'))
        if not flag:
            print(course_list)
            break

        # 2.打印所有课程,并让老师选择
        for index, course_name in enumerate(course_list):
            print(f'编号:{index}    课程名:{course_name}')

        choice = input('请输入选择的课程编号:').strip()

        if not choice.isdigit():
            print('输入有误')
            continue

        choice = int(choice)

        if choice not in range(len(course_list)):
            print('输入编号有误!')
            continue

        # 3.获取选择的课程名称
        course_name = course_list[choice]

        # 4.利用当前课程名称获取所有学生
        flag2, student_list = teacher_interface.get_student_interface(course_name, teacher_info.get('user'))

        if not flag2:
            print(student_list)
            break

        # 5.打印所有学生让老师选择
        for index, student_name in enumerate(student_list):
            print(f'编号:{index}   学生名:{student_name}')

        choice2 = input('请输入学生编号:').strip()

        if not choice2.isdigit():
            print('输入错误')
            continue

        choice2 = int(choice2)

        if choice2 not in range(len(course_list)):
            print('输入编号有误')
            continue

        # 6.获取选择的课程名称
        course_name = course_list[choice2]

        # 7.老师输入需要修改的分数
        score = input('请输入需要修改的成绩:').strip()
        if not score.isdigit():
            print('输入错误')
            continue

        score = int(score)

        flag3, msg = teacher_interface.change_score_interface(course_name, student_name, score,
                                                              teacher_info.get('user'))

        if flag3:
            print(msg)
            break