Пример #1
0
def make_test_problem_db():
    test_problem_db = {}
    test_problem_db[1] = Problem(
        1, 'unassigned',
        {'question': 'text for problem number 1 \nwith a second line'},
        'Arc Length', 4, 5, 0, 'test')
    test_problem_db[2] = Problem(
        2, 'Area of Circles',
        {'question': 'more text \nThis problem (\\#2) has \nthree lines'},
        'Sector', 4, 5, 0, 'test')
    test_problem_db[3] = Problem(
        3, 'unassigned',
        {'question': 'Problem text for problem number 3 \nwith a second line'},
        'Arc Length', 4, 5, 0, 'test')
    return test_problem_db
Пример #2
0
def import_problems_from_files():
    """ Upload problems from indir problems files

        problems.csv - flatfile, fields: Topic,Difficulty,Calculator,Level,Text,Resource,Instructions
        """
    # IMPORT PROBLEMS AND SET UP FOR DEC 14 PROBLEM SET as imported_problems {}
    # INFILE
    infile = indir + "problems.csv"
    i = 0
    with open(infile, "r", encoding='latin-1') as r_file:
        f = csv.reader(r_file, delimiter=',', quotechar='"')
        for row in f:
            print(i)
            i += 1
            topic = row[0]
            standard = lookup_standard(topic)
            difficulty = row[1]
            calculator = row[2]
            level = row[3]
            question = row[4]
            resource = row[5]
            instructions = row[5]
            texts = {"question": question, "resource": resource, "instructions": instructions}
            source = "cjh"
            problem_id = lookup_new_problem_id(topic, difficulty)
                #NOT YET IMPORTED: workspace, answer, solution, rubric
            global_problem_dict[topic] = {difficulty: {problem_id: \
                Problem(topic, texts, standard, difficulty, level, calculator, source)}}

    # DELETE ENTRY WITH CORRUPT KEY FROM FIRST (TITLE) ROW IN IMPORTED FILE
    for topic in global_problem_dict:
        if topic[-3:] == "pic":
            del global_problem_dict[topic]
Пример #3
0
def saveproblem(problem, topic="Writing Linear Equations", \
                difficulty=5, problemID=0):
    '''problem: list of text lines
        topic, difficulty: branches of problem dictionary
        problemID: assigned if not given as argument
        
        returns problem in global_problem_dict format
        '''
    if problemID == 0:
        problemID = lookup_new_problem_id(topic, difficulty)
    problemdict = {topic: {difficulty: {0: 'null problem instance'}}}
    problemdict[topic][difficulty].update(
        {problemID: Problem(topic, {"question": problem})})
    problemdict[topic][difficulty].pop(0)
    return problemdict
Пример #4
0
def parse_tex_into_problemset():  #TODO make this into a worksheet importer
    title = ("1214IB1_Test-exponentials", "ids in margin", \
             "Parsed from file: in/1214IB1_Test-exponentials.tex")
    infile = indir + title[0] + ".tex"

    default_topic = "Writing Linear Equations"
    default_difficulty = 5

    topic = default_topic
    difficulty = default_difficulty
    with open(infile, "r") as texfile:
        for line in texfile:
            print(line)
            if '\item' in line:
                for index in range(len(line) - 6):
                    if line[index:index + 5] == '\item':
                        global_problem_dict[topic][difficulty] = \
                        {lookup_new_problem_id(topic, difficulty): Problem(topic, \
                            {"question": line[index +6:]})}

            elif "\subsection*" in line:
                for index in range(len(line) - 13):
                    if line[index:index + 12] == "\subsection*":
                        topic = line[index + 13:-2]
Пример #5
0
import pickle

#Hydrogen path config workaround:
#%cd src
%pwd

from main import loaddbfile
from class_organization import ProblemSet, Problem, Course, Student

#ct = loaddbfile("courses")

# Temporary sandbox lines of code are below
roster = ["Elias", "Marcus"]
skillset = {"Inverse of Functions":3, "Evaluating Expressions":2, \
			"Evaluating Logarithmic Expressions":5}
cIB1 = Course("11.1 IB Math SL", roster)

for student in cIB1.roster:
	cIB1.roster[student].skillset = skillset

cIB1.print_roster(1) #not sure why this doesn't work.

question = "What is the equation of a line parallel to $y=-3x+6$ with a $y$-intercept of 5?"
texts = {"question":question}
topic = "Writing Linear Equations"

p1 = Problem(topic, texts)

print(p1.format(1))
print(p1.texts["question"])