Ejemplo n.º 1
0
def choose_course():
    course_list=common_interface.check_info('course')
    if course_list:
        for i,name in enumerate(course_list):
            print(i+1,name)
        dec= input('please choice>>"').strip()
        if dec.isdigit():
            dec = int(dec)
            if dec in range(1, len(course_list) + 1):
                course_name = course_list[dec - 1]
                teacher_interface.choose_course(course_name,user_data['name'])
                print('选课成功')
                return
            else:print('not in range')
        else:print('must be int ')
    else:print('暂无任何课程')
Ejemplo n.º 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('请输入数字')