Exemple #1
0
def choice_cource():
    while True:
        # 获取当前登录学生所在学校的所有课程
        flag, course_list_msg = student_interface.get_course_list_interface(
            student_name=student_info.get('user'))

        if not flag:
            print(course_list_msg)

        for index, course_name in enumerate(course_list_msg):
            print(f'课程编号: {index}   课程名: {course_name}')

        choice_cou = input('请输入课程编号:').strip()

        if not choice_cou.isdigit():
            print('请输入合法指令')
            continue

        choice_cou = int(choice_cou)
        if choice_cou not in range(len(course_list_msg)):
            print('请输入合法指令')
            continue

        # 获取选择课程的名称
        course_name = course_list_msg[choice_cou]

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

        if flag:
            print(msg)
            break
        else:
            print(msg)
            break
Exemple #2
0
def select_course():
    # 先获取当前学生所在学校的课程列表,再选择对应的课程
    while True:
        flag, course_list = student_interface.get_course_interface(
            student_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 = student_interface.choice_course_interface(
            course_name, student_info['user'])
        if flag:
            print(msg)
            break
        else:
            print(msg)
Exemple #3
0
def choice_course():
    while 1:
        flag, msg = student_interface.check_course_interface(
            student_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 = student_interface.choice_course_interface(
            course_name, student_name.get('user')
        )
        if flag1:
            print(msg1)
            break

        else:
            print(msg1)
def choice_course():
    print("choice_course...")

    course_list = student_interface.get_course_list(user_dic["user"])
    if course_list:
        for i, course in enumerate(course_list):
            print(f"学校编号{i} {course}")

        index = input("请输入选择的学校编号")

        if index.isdigit() and int(index) in range(len(course_list)):
            index = int(index)

            course_name = course_list[index]

            flag = student_interface.choice_course_interface(user_dic["user"], course_name)
            if flag:
                print(f"成功选择课程: {course_name}")
        else:
            print("输入错误")
Exemple #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, course_name in enumerate(course_list):
            print(f'编号:{index},\t课程:{course_name}')
        choice = input('请选择对应编号:')
        if choice.isdigit():
            choice = int(choice)
            if choice in range(len(course_list)):
                flag, msg = student_interface.choice_course_interface(
                    course_list[choice], student_info.get('user'))
                if flag:
                    print(msg)
                    break
            else:
                print('请输入正确编号!')
        else:
            print('请输入正确编号!')