Exemplo n.º 1
0
def choice_course():
    while True:
        #1.获取当前学生所在学校的课程列表
        flag, course_list_or_msg = student_interface.get_course_list_interface(
            student_info.get('user'))
        if not flag:
            print(course_list_or_msg)
            break

        # 2.打印课程列表,供学生选择
        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]

        flag, msg = student_interface.add_course_interface(
            student_info.get('user'), course_name)

        if flag:
            print(msg)
            break
        else:
            print(msg)
Exemplo n.º 2
0
def choice_course():
    while True:
        # 1.先获取当前学生所在学校的列表
        flag,course_list = student_interface.get_course_list_interface(student_info['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]
        flag,msg = student_interface.add_course_interface(course_name,student_info['user'])
        if flag:
            print(msg)
            break
        else:
            print(msg)
Exemplo n.º 3
0
def choice_course():
    while True:
        # 1.先获取当前学生所在学校的课程列表
        flag, course_list = student_interface.get_course_list_interface(
            student_info.get('user'))
        if not flag:
            print(course_list)
            break
        # 2、打印课程列表,并让用户选择课程
        for index, school_name in enumerate(course_list):
            print(f'编号:{index}   学校名:{school_name}')

        # 3. 让学生输入学校编号
        choice = input('请输入选择的学校编号:').strip()
        if not choice.isdigit():
            print('输入有误')
            continue

        choice = int(choice)

        if choice not in range(len(course_list)):
            print('输入编号有误!')
            continue
        # 4.获取选择的功课名称
        course_name = course_list[choice]

        # 5.调用学生选择课程接口
        msg = student_interface.add_course_interface(course_name,
                                                     student_info.get('user'))
        print(msg)
        break
Exemplo n.º 4
0
def choose_course():
    while True:
        flag, course_list = student_interface.check_course_interface(
            student_info.get('user'))

        if not flag:
            print(course_list)
            break

        for index, course_name in enumerate(course_list):
            print(f'ID [{index}]  Course name [{course_name}]')

        choice = input('Please input Course\'s ID(Press q to quit):').strip()

        if choice.lower() == 'q':
            print('Quit success')
            break

        if not choice.isdigit():
            print('Please input number')
            continue

        choice = int(choice)

        if choice not in range(len(course_list)):
            print('Please input correct number')
            continue

        course_name = course_list[choice]

        flag, msg = student_interface.add_course_interface(
            course_name, student_info.get('user'))

        if flag:
            print(msg)
            break

        else:
            print(msg)
Exemplo n.º 5
0
def choice_course():
    while True:
        # 1、先获取 "当前学生" 所在学校的课程列表
        flag, course_list = student_interface.get_course_list_interface(
            student_info.get('user'))
        if not flag:
            print(course_list)
            break

        # 2、打印课程列表,并让用户选择课程
        for index, school_name in enumerate(course_list):
            print(f'编号: {index}   学校名: {school_name}')

        # 2、让学生输入学校编号
        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、调用学生选择课程接口
        flag, msg = student_interface.add_course_interface(
            course_name, student_info.get('user'))

        if flag:
            print(msg)
            break
        else:
            print(msg)