Example #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
Example #2
0
def choice_course():
    #1先获取当前学生所在学校的课程
    while True:
        flag,course_list = student_interface.get_course_list_interface(
            student_info.get("user"))
        if not flag:
            print(course_list)
            break
        for index ,choice_name in enumerate(course_list):
            print ("编号%s,学校%s"%(index,choice_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]
        flag, mag=student_interface.add_coure_interface(
            course_name,student_info.get("user")
        )
        if flag:
            print(mag)
            break
        else:
            print(mag)
Example #3
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)
Example #4
0
def choose_course():
    while True:
        flag, course_list_or_msg = student_interface.get_course_list_interface(student_info['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]
        flag, msg = student_interface.choose_course_interface(course_name, student_info['user'])
        if flag:
            print('msg')
            break
        else:
            print('msg')
Example #5
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)
Example #6
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
Example #7
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)
def choose_course():
    print('欢迎选择课程')

    while True:
        username = user_info['username']
        flag,course_list = student_interface.get_course_list_interface(username)
        if not flag:
            print(course_list)
            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]

        flag,msg = student_interface.choose_course_interface(username,course_name)
        if flag:
            print(msg)
            break
        else:
            print(msg)
Example #9
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('请输入正确编号!')