Exemple #1
0
def decimal_divide():
    ans = gen_rand_decimal(3, 2)
    n1 = randint(2, 12)
    n2 = n1 * ans
    q = question(None, f'{n2} ÷ {n1} =', f'{ans}', 'decimal', level,
                 'Express your answer in Decimal')
    return q
Exemple #2
0
def faction_add():
    n1 = Fraction(randint(1, 9), randint(9, 15))
    n2 = Fraction(randint(2, 9), randint(9, 16))
    ans = n1 + n2
    q = question(None, f'{n1} + {n2} =', f'{ans}', 'fraction', level,
                 'Express your answer in Simplified Fraction')
    return q
Exemple #3
0
def integer_divide():
    ans = gen_rand_int(randint(1, 3))
    n1 = randint(2, 12)
    n2 = n1 * ans
    q = question(None, f'{n2} ÷ {n1} =', f'{ans}', 'int', level,
                 'Express your answer in number')
    return q
Exemple #4
0
def decimal_multiply():
    n1 = gen_rand_decimal(1, 2)
    n2 = gen_rand_decimal(1, 1)
    ans = n1 * n2
    q = question(None, f'{n1} * {n2} =', f'{ans}', 'decimal', level,
                 'Express your answer in Decimal')
    return q
Exemple #5
0
def decimal_add():
    n1 = gen_rand_decimal(2, 2)
    n2 = gen_rand_decimal(3, 1)
    ans = n1 + n2
    q = question(None, f'{n1} + {n2} =', f'{ans}', 'decimal', level,
                 'Express your answer in Decimal')
    return q
Exemple #6
0
def integer_multiply():
    n1 = gen_rand_int(randint(1, 3))
    n2 = gen_rand_int(randint(1, 2))
    ans = n1 * n2
    q = question(None, f'{n1} * {n2} =', f'{ans}', 'int', level,
                 'Express your answer in number')
    return q
Exemple #7
0
def integer_add():
    n1 = gen_rand_int(randint(1, 5))
    n2 = gen_rand_int(randint(1, 4))
    ans = n1 + n2
    q = question(None, f'{n1} + {n2} =', f'{ans}', 'int', level,
                 'Express your answer in number')
    return q
Exemple #8
0
def faction_add_minus():
    n1 = Fraction(randint(2, 6), randint(6, 12))
    n2 = Fraction(randint(3, 9), randint(9, 15))
    n3 = Fraction(randint(1, 4), randint(10, 15))
    ans = n1 + n2 - n3
    q = question(None, f'{n1} + {n2} - {n3} =', f'{ans}', 'fraction', level,
                 'Express your answer in Simplified Fraction')
    return q
Exemple #9
0
def faction_minus():
    n1 = Fraction(randint(1, 9), randint(9, 12))
    n2 = Fraction(randint(2, 9), randint(9, 16))
    if n1 < n2:
        tmp = n1
        n1 = n2
        n2 = tmp
    ans = n1 - n2
    q = question(None, f'{n1} - {n2} =', f'{ans}', 'fraction', level,
                 'Express your answer in Simplified Fraction')
    return q
Exemple #10
0
def decimal_minus():
    n1 = gen_rand_decimal(3, 2)
    n2 = gen_rand_decimal(3, 1)
    if n1 < n2:
        tmp = n1
        n1 = n2
        n2 = tmp
    ans = n1 - n2
    q = question(None, f'{n1} - {n2} =', f'{ans}', 'decimal', level,
                 'Express your answer in Decimal')
    return q
Exemple #11
0
def integer_minus():
    n1 = gen_rand_int(randint(1, 5))
    n2 = gen_rand_int(randint(1, 5))
    if n1 < n2:
        tmp = n1
        n1 = n2
        n2 = tmp
    ans = n1 - n2
    q = question(None, f'{n1} - {n2} =', f'{ans}', 'int', level,
                 'Express your answer in number')
    return q
Exemple #12
0
def gen_rand_fraction_equation(p):
    (eq,ans) = recur_gen_rand_fraction_equation(p)
    print(f'eq={eq}')
    #ans = eval(eq)
    q = question(None, f'{eq}=', f'{ans}', 'fraction', 5, 'Express your answer in Simplified Fraction')
    return q
Exemple #13
0
def gen_rand_equation(p):
    eq = recur_gen_rand_equation(p)
    ans = round(eval(eq),8)
    ans_in_decimal = Decimal(f'{ans}')
    q = question(None, f'{eq}=', f'{ans_in_decimal}', 'decimal', 5, 'Express your answer in Decimal')
    return q