示例#1
0
def choose_course():
    print('选择教授课程')
    course_list = teacher_interface.check_all_course()
    if not course_list:
        print('请先联系管理员创建课程')
        return
    while True:
        for i, course in enumerate(course_list):
            print('%s :%s' % (i, course))

        choose = input('请选择课程(数字)').strip()
        if choose == 'q': break
        if choose.isdigit():
            choose = int(choose)
            if choose < len(course_list):
                flag, msg = teacher_interface.choose_teach_course(
                    teacher_info['name'], course_list[choose])
                if flag:
                    print(msg)
                    break
                else:
                    print(msg)
            else:
                print('请输入范围内的数字')

        else:
            print('请输入数字')
示例#2
0
def choose_course():
    print('选择教授课程')
    while True:
        course_list = teacher_interface.check_all_course()
        if not course_list:
            print('暂无课程可以选择,请联系管理员创建课程')
            return
        for i, course in enumerate(course_list):
            print('%s :%s' % (i, course))
        choice = input('请选择您要教授的课程:').strip()
        if choice == 'q': break
        if choice.isdigit():
            choice = int(choice)
            if choice >= 0 and choice < len(course_list):
                teacher_interface.choose_course(teacher_info['name'],
                                                course_list[choice])
                break
            else:
                print('请选择存在的课程')
        else:
            print('请输入数字')