Exemplo n.º 1
0
import random
from config import latex_jinja_env

r_db = latex_jinja_env.get_template('templates/rectangles/r_db.tex')


def get_q9():
    answers = {1: 67, 2: 68, 3: 69, 4: 70}
    name = [
        'Doug',
        'Dustin',
    ]
    name_action = [
        'is starting', 'is beginning', 'is following', 'has started',
        'is commencing', 'commences'
    ]
    program = [
        'training program', 'training regimen', 'workout program',
        'workout regimen', 'exercise program', 'exercise regimen',
        'running regimen', 'running program', 'fitness program',
        'fitness regimen', 'cardio training program',
        'cardio training regimen', 'cardio workout program',
        'cardio workout regimen', 'cardio exercise program',
        'cardio exercise regimen', 'cardio running regimen',
        'cardio running program', 'cardio fitness program',
        'cardio fitness regimen'
    ]
    frequency = [
        'Every Monday', 'Every Tuesday', 'Every Wednesday', 'Every Thursday',
        'Every Friday', 'Every Saturday', 'Every Sunday'
    ]
Exemplo n.º 2
0
    arcs.get_al_dml(),
    arcs.get_al_lcm(),
    arcs.get_al_lrm(),
    arcs.get_al_ldm(),
    arcs.get_al_lmc(),
    arcs.get_al_lmr(),
    arcs.get_al_lmd(),
]

for current_question in question_set:
    q = current_question['q']
    a = current_question['a']
    questions.append(q)
    answers.append(a)

question_template = latex_jinja_env.get_template(questions_input_file)
renderedQuestions = question_template.render(questions=questions)
answer_template = latex_jinja_env.get_template(answers_input_file)
renderedAnswers = answer_template.render(answers=answers)

with open(math_test + '.tex', 'w') as f:
    f.write(renderedQuestions)
cmd = ['pdflatex', '-interaction', 'batchmode', math_test + '.tex']
proc = subprocess.Popen(cmd)
proc.communicate()

retcode = proc.returncode
if not retcode == 0:
    os.unlink(math_test + '.pdf')
    raise ValueError('Error {} executing command: {}'.format(
        retcode, ' '.join(cmd)))
Exemplo n.º 3
0
import math
import random
import subprocess
import sys
from config import latex_jinja_env
from config import formulas_q

q_s = latex_jinja_env.get_template('templates/quadrants/q_sign.tex')


def get_q_sign():
    r_answer = random.randint(0, len(formulas_q))
    r_quadrant = formulas_q[r_answer]
    r_question = random.choice(r_quadrant)
    answers = [
        'Quadrant I',
        'Quadrant II',
        'Quadrant III',
        'Quadrant IV',
    ]
    answer = answers[r_answer]
    random.shuffle(answers)
    print(r_quadrant)
    return {
        'q':
        q_s.render(term1=r_question[0],
                   sign1=r_question[1],
                   term2=r_question[2],
                   sign2=r_question[3],
                   answers=answers),
        'a':
Exemplo n.º 4
0
import math
import random
import subprocess
import sys
from config import latex_jinja_env
from config import formulas_al

al_cma = latex_jinja_env.get_template('templates/arcs/al_cma.tex')
al_rma = latex_jinja_env.get_template('templates/arcs/al_rma.tex')
al_dma = latex_jinja_env.get_template('templates/arcs/al_dma.tex')
al_lcm = latex_jinja_env.get_template('templates/arcs/al_lcm.tex')
al_ldm = latex_jinja_env.get_template('templates/arcs/al_ldm.tex')
al_lrm = latex_jinja_env.get_template('templates/arcs/al_lrm.tex')
al_lmc = latex_jinja_env.get_template('templates/arcs/al_lmc.tex')
al_lmr = latex_jinja_env.get_template('templates/arcs/al_lmr.tex')
al_lmd = latex_jinja_env.get_template('templates/arcs/al_lmd.tex')


def get_random_unit_circle_angle():
    return random.choice([
        30, 45, 60, 90, 120, 135, 150, 180, 210, 225, 240, 270, 300, 315, 330
    ])


def get_random_circumference():
    return random.randint(1, 1500)


def get_random_radius():
    return random.randint(1, 750)
Exemplo n.º 5
0
import math
import random
import subprocess
import sys
from config import latex_jinja_env
from config import formulas_a
from config import pythag_triples
from config import formulas_ftr
from config import questions_ftr

g_b = latex_jinja_env.get_template('templates/graphs/blank.tex')
t_b = latex_jinja_env.get_template('templates/tables/blank.tex')

# def get_tb():
#   return t_b.render(i1=1,i2=2,i3=3,i4=4,i5=5,i6=6,o1=-2,o2=0,o3=4,o4=10,o5=18,o6=28)
# def get_gb():
#   return {
#   'q': g_b.render(n=-5, d=3),
#   'a': 20
#   }


def get_finding_trig_ratio():
    p_triple = random.choice(pythag_triples)
    multiplier = random.randint(p_triple['multi_range']['min'],
                                p_triple['multi_range']['max'])
    a = p_triple['a'] * multiplier
    b = p_triple['b'] * multiplier
    c = p_triple['c'] * multiplier
    formula = formulas_ftr[1]
    question = random.choice(questions_ftr)