'''
Created on 02-Mar-2021

@author: bthakur
'''
'''
Created on 07-Feb-2021

@author: bthakur
'''
import numpy as np
import random
import inspect
import traceback

from sympy import (simplify, sympify, log, latex, Symbol, symbols, 
                   UnevaluatedExpr as ueval)

from xv.km.util import latex_fraction
from xv.km.kelements import KPrintElement
        
from ..helper import BaseHelper
from xv.km.managers import BaseManager
from xv.km.kelements import KProblemTemplate

# _grade7_manager
# Grade7Manager
        
class Grade7Manager(BaseManager):
    '''
    LCM
    Example:
        ke = Grade7Manager()
        ke.getRandomProblem()
        ke.getRandomProblem(problem_type = 0)
        ke.getRandomProblem(problem_type = 1)
        ...
        ke.printProblem()
        ke.printAnswer()
        ke.printSolution()

        ke.printProblemTypes()
    '''    
    def __new__(cls, *args, **kwargs):
        instance = super(Grade7Manager, cls).__new__(cls, *args, **kwargs)
        for base_class in Grade7Manager.__bases__:
            base_class.__init__(instance, *args, **kwargs)
        return instance
    
    def __init__(self, *args, **kwargs):
        self.base_helper = BaseHelper(**kwargs)
        pass

    def _TEMPLATE_CUSTOM_QUESTIONS(self, keywords, **kwargs):
        
        from ..storeddata import Grade7StoredQuestions
        
        stored_questions = Grade7StoredQuestions(verbose = self.verbose)
        result = stored_questions.get_random_question(keywords)

        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        if result is None:
            prob_s = f"""
            Failed to get questions
            keywords = {keywords}
            """
            problemTemplate.add_problem(prob_s.strip(), 'text/html')
            return problemTemplate
            
        
        prob_s = f"""
        {result['prob_s']}
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        {result['soln_s']}
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        {result['answer_s']}
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass


    def _init_problem_types(self, *args, **kwargs):
        self._append_problem_types([
            '_problem_custom_questions_division_sign',
            '_problem_custom_questions_algebric_equation',
            '_problem_custom_questions_angles',
            '_problem_custom_questions_figure_scaling',
            '_problem_custom_questions_algebric_equation_1',
            '_problem_custom_questions_draw_shapes_map',
            '_problem_custom_questions_algebric_equation_2',
            '_problem_custom_questions_statistics',
            '_problem_custom_questions_arithmetic',
            '_problem_custom_questions_proportionality',
            '_problem_custom_questions_simplification',
            '_problem_custom_questions_triangles',
            '_problem_custom_questions_circumference',
            '_problem_custom_questions_division_sign_1',
            '_problem_custom_questions_scaling_figure',
            '_problem_custom_questions_proportionality_1',
            '_problem_custom_questions_fraction_decimal',
            '_problem_custom_questions_angle_relation',
            '_problem_custom_questions_numberline',
            '_problem_custom_questions_speed_time_equation',
            '_problem_custom_questions_percentage_operation',
            '_problem_custom_questions_algebric_expr',
            '_problem_custom_questions_numberline_1',
            '_problem_custom_questions_word_problem',


            '_problem_constant_of_proportionality',
            '_problem_miles_per_hour',
            '_problem_one_to_one_correspondence_between_two_figures_in_the_plane',
            '_problem_proportional_relationship',
            '_problem_proportional_to',
            '_problem_scale_drawing_and_scale_factor',
            '_problem_additive_identity',
            '_problem_additive_inverse',
            '_problem_formula_for_the_distance_between_two_numbers',
            '_problem_multiplicative_identity',
            '_problem_repeating_decimal_expansion',
            '_problem_terminating_decimal_expansion',
            '_problem_circle',
            '_problem_circular_region_or_disk',
            '_problem_circumference',
            '_problem_coefficient_of_a_term',
            '_problem_diameter_of_a_circle',
            '_problem_expression_in_expanded_form',
            '_problem_expression_in_factored_form',
            '_problem_expression_in_standard_form',
            '_problem_interior_of_a_circle',
            '_problem_pi',
            '_problem_term',
            '_problem_absolute_error',
            '_problem_percent_error',
            '_problem_chance_experiment',
            '_problem_chance_process',
            '_problem_event',
            '_problem_frequency_of_an_event',
            '_problem_long_run_relative_frequency',
            '_problem_population',
            '_problem_probability',
            '_problem_probability_model',
            '_problem_probability_simulation',
            '_problem_random_sample',
            '_problem_relative_frequency_of_an_event',
            '_problem_sample',
            '_problem_sample_space',
            '_problem_sample_statistic',
            '_problem_statistical_inference',
            '_problem_uniform_probability_model',
            '_problem_right_rectangular_pyramid',
            '_problem_surface_of_a_pyramid',
            '_problem_three_sides_condition',
            '_problem_triangle_correspondence',
            '_problem_triangles_with_identical_measures',
            '_problem_two_angles_and_the_included_side_condition',
            '_problem_two_angles_and_the_side_opposite_a_given_angle_condition',
            '_problem_two_sides_and_the_included_angle_condition',
                    
         ]) 
        pass

    def _problem_custom_questions_division_sign(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'division_sign')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_algebric_equation(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'algebric_equation')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_angles(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'angles')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_figure_scaling(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'figure_scaling')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_algebric_equation_1(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'algebric_equation_1')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_draw_shapes_map(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'draw_shapes_map')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_algebric_equation_2(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'algebric_equation_2')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_statistics(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'statistics')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_arithmetic(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'arithmetic')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_proportionality(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'proportionality')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_simplification(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'simplification')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_triangles(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'triangles')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_circumference(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'circumference')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_division_sign_1(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'division_sign_1')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_scaling_figure(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'scaling_figure')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_proportionality_1(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'proportionality_1')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_fraction_decimal(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'fraction_decimal')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_angle_relation(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'angle_relation')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_numberline(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'numberline')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_speed_time_equation(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'speed_time_equation')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_percentage_operation(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'percentage_operation')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_algebric_expr(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'algebric_expr')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_numberline_1(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'numberline_1')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)

    def _problem_custom_questions_word_problem(self, *args, **kwargs):
        keywords = kwargs.get('keywords', 'word_problem')
        return self._TEMPLATE_CUSTOM_QUESTIONS(keywords, **kwargs)




    def _problem_constant_of_proportionality(self, *args, **kwargs):
        """
        If a proportional relationship is described by the set of ordered pairs that satisfies the equation , where k is a positive constant, then k is called the constant of proportionality. For example, if the ratio of y to x is 2 to 3, then the constant of proportionality is , and .
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_miles_per_hour(self, *args, **kwargs):
        """
        One mile per hour is a proportional relationship between d miles and t hours given by the equation (both d and t are positive real numbers). Similarly, for any positive real number v, v miles per hour is a proportional relationship between d miles and t hours given by . The unit for the rate, mile per hour (or mile/hour) is often abbreviated as mph.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_one_to_one_correspondence_between_two_figures_in_the_plane(self, *args, **kwargs):
        """
        (description) For two figures in the plane, S and S?, a one-to-one correspondence between the figures is a pairing between the points in S and the points in S? so that each point P of S is paired with one and only one point P? in S?, and likewise, each point Q?? in S? is paired with one and only one point Q in S.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_proportional_relationship(self, *args, **kwargs):
        """
        (description) A proportional relationship is a correspondence between two types of quantities such that the measures of quantities of the first type are proportional to the measures of quantities of the second type. Note that proportional relationships and ratio relationships describe the same set of ordered pairs but in two different ways. Ratio relationships are used in the context of working with equivalent ratios, while proportional relationships are used in the context of rates.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_proportional_to(self, *args, **kwargs):
        """
        (description) Measures of one type of quantity are proportional to measures of a second type of quantity if there is a number k so that for every measure x of a quantity of the first type, the corresponding measure y of a quantity of the second type is given by kx; that is, . The number k is called the constant of proportionality.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_scale_drawing_and_scale_factor(self, *args, **kwargs):
        """
        (description) For two figures in the plane, S and S?, S? is said to be a scale drawing of S with scale factor r if there exists a one-to-one correspondence between S and S? so that, under the pairing of this one-to-one correspondence, the distance |PQ| between any two points P and Q of S is related to the distance |P?Q?| between corresponding points P? and Q? of S? by .
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_additive_identity(self, *args, **kwargs):
        """
        The additive identity is the number 0.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_additive_inverse(self, *args, **kwargs):
        """
        additive inverse of a number is a number such that the sum of the two numbers is 0. The additive inverse of a number a is the opposite of a (i.e., ) because if we add both numbers, we get .
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_formula_for_the_distance_between_two_numbers(self, *args, **kwargs):
        """
        If p and q are numbers on a number line, then the distance between p and q is .
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_multiplicative_identity(self, *args, **kwargs):
        """
        The multiplicative identity is the number 1.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_repeating_decimal_expansion(self, *args, **kwargs):
        """
        A decimal expansion is repeating if, after some digit to the right of the decimal point, there is a finite string of consecutive digits called a block, after which the decimal expansion consists entirely of consecutive copies of that block repeated forever. A common notation for a repeating decimal expansion is to write out the decimal expansion until the end of the first block and then writing a line over the block. For example, is a compact way to write the repeating decimal expansion 3.125252525.?.?.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_terminating_decimal_expansion(self, *args, **kwargs):
        """
        A terminating decimal expansion is a repeating decimal expansion with period 1 and repeating digit 0. For example, the terminating decimal expansion of is 0.25000.?.?.?, or . A number with a terminating decimal expansion can be written as a finite decimal. For example, the terminating decimal expansion 0.25000.?.?. represents the same number as the finite decimal 0.25.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_circle(self, *args, **kwargs):
        """
         Given a point O in the plane and a number , the circle with center O and radius r is the set of all points in the plane whose distance from the point O is equal to r.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_circular_region_or_disk(self, *args, **kwargs):
        """
        Given a point C in the plane and a number , the circular region (or disk) with center C and radius r is the set of all points in the plane whose distance from the point C is less than or equal to r.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_circumference(self, *args, **kwargs):
        """
         The circumference of a circle is the distance around the circle.2
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_coefficient_of_a_term(self, *args, **kwargs):
        """
        he coefficient of a term is the number found by multiplying all of the number factors in a term together.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_diameter_of_a_circle(self, *args, **kwargs):
        """
        The diameter of a circle is the length of any segment that passes through the center of a circle whose endpoints lie on the circle. If r is the radius of a circle, then the diameter is 2r.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_expression_in_expanded_form(self, *args, **kwargs):
        """
        (description) An expression that is written as sums (and/or differences) of products whose factors are numbers, variables, or variables raised to whole number powers is said to be in expanded form. A single number, variable, or a single product of numbers and/or variables is also considered to be in expanded form.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_expression_in_factored_form(self, *args, **kwargs):
        """
        (description) An expression that is a product of two or more expressions is said to be in factored form.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_expression_in_standard_form(self, *args, **kwargs):
        """
        (description) An expression that is in expanded form where all like terms have been collected is said to be in standard form.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_interior_of_a_circle(self, *args, **kwargs):
        """
        The interior of a circle with center C and radius r is the set of all points in the plane whose distance from the point C is less than r.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_pi(self, *args, **kwargs):
        """
         The number pi, denoted ?, is the value of the ratio given by the circumference to the diameter, that is, ? = (circumference)/(diameter).
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_term(self, *args, **kwargs):
        """
         (description) Each summand of an expression in expanded form is called a term.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_absolute_error(self, *args, **kwargs):
        """
        Given the exact value x of a quantity and an approximate value a of it, the absolute error is .
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_percent_error(self, *args, **kwargs):
        """
        The percent error is the percent the absolute error is of the exact value, i.e., , where x is the exact value of the quantity and a is an approximate value of the quantity.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_chance_experiment(self, *args, **kwargs):
        """
        (description) A chance experiment consists of observing a single outcome of a chance process.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_chance_process(self, *args, **kwargs):
        """
        (description) A chance process is any process that is repeatable and results in one of two or more well-defined outcomes each time it is repeated. The act of performing the process and producing a result is called a trial. In a chance process, trials are independent from each other in that the result of one trial does not influence the result of any other trial. In the context of probability, observing a single outcome of a chance process is sometimes called a chance experiment.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_event(self, *args, **kwargs):
        """
         An event is a subset of outcomes of the sample space. A simple event is an event with a single outcome. A compound event is an event that is the union of two or more simple events.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_frequency_of_an_event(self, *args, **kwargs):
        """
        The frequency of an event is the number of trials for which the event occurred in performing a fixed number of trials of a chance process.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_long_run_relative_frequency(self, *args, **kwargs):
        """
        (description) The long-run relative frequency is the number that the relative frequencies get closer and closer to as more and more trials are performed. The long-run relative frequency for a large number of trials provides an estimate of the probability of that event occurring that can be used when the probability of that event is hard to calculate from the probability model.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_population(self, *args, **kwargs):
        """
         (description) A population is any entire collection of people, animals, plants, or things that someone is interested in learning about. Each person or object in the population is called a member.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_probability(self, *args, **kwargs):
        """
         (description) The probability of an event is a number between 0 and 1 that measures the chance that the event will occur.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_probability_model(self, *args, **kwargs):
        """
        (description) A probability model is a mathematical representation of a chance process defined by its sample space, events within the sample space, and the assignment of a probability for each and every event.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_probability_simulation(self, *args, **kwargs):
        """
        (illustration) A probability simulation is the use of a random number generator (e.g., spinners, coin toss, computers) to generate outcomes that are consistent with a given probability model. For example, to estimate the probability that a family with 4 children will include 3 or more boys, the children in a family might be represented by a sequence of four random digits, with even digits representing a girl and odd digits representing a boy. This would generate "families" using a model that is consistent with a family having 4 children and each child being equally likely to be male or female. A large number of simulated families could be generated using technology, and then the relative frequency of those with 3 or more boys provides an estimate of the probability that a family with 4 children will include 3 or more boys.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_random_sample(self, *args, **kwargs):
        """
        A random sample of size n is a sample that is selected using a process that ensures that every different possible sample of size n had the same chance of being selected as the sample. This selection process implies that every individual member of the population has the same chance of being included in the sample.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_relative_frequency_of_an_event(self, *args, **kwargs):
        """
        The relative frequency of an event is the value given by the frequency of the event divided by the total number of trials.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_sample(self, *args, **kwargs):
        """
         A sample is any subset of a population.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_sample_space(self, *args, **kwargs):
        """
        The sample space of a chance process is the set of all possible outcomes. For example, the sample space for the experiment of rolling a die is the set {1, 2, 3, 4, 5, 6}.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_sample_statistic(self, *args, **kwargs):
        """
        (description) A sample statistic or statistic is a number (e.g., mean, standard deviation) that is calculated from a sample. Statistics are used to estimate, predict, or make decisions about population parameters.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_statistical_inference(self, *args, **kwargs):
        """
        he process of drawing conclusions about population parameters using sample statistics. In Grade 7, this can be described as "the process of drawing conclusions about populations using information from a sample of the population."
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_uniform_probability_model(self, *args, **kwargs):
        """
        A uniform probability model is a probability model that assigns the same probability for all simple events of the sample space.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_right_rectangular_pyramid(self, *args, **kwargs):
        """
        Given a rectangular region B in a plane E and a point V not in E, the rectangular pyramid with base B and vertex V is the union of all segments VP for any point P in B. It can be shown that the planar region defined by a side of the base B and the vertex V is a triangular region called a lateral face. If the vertex lies on the line perpendicular to the base at its center (i.e., the intersection of the rectangle's diagonals), the pyramid is called a right rectangular pyramid.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_surface_of_a_pyramid(self, *args, **kwargs):
        """
        The surface of a pyramid is the union of its base region and its lateral faces.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_three_sides_condition(self, *args, **kwargs):
        """
        wo triangles satisfy the three sides condition if there is a triangle correspondence between the two triangles such that each pair of corresponding sides are equal in length.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_triangle_correspondence(self, *args, **kwargs):
        """
        A triangle correspondence between two triangles is a pairing of each vertex of one triangle with one and only one vertex of the other triangle. A triangle correspondence also induces a correspondence between the angles of the triangles and the sides of the triangles.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_triangles_with_identical_measures(self, *args, **kwargs):
        """
        o triangles are said to have identical measures if there is a triangle correspondence such that all pairs of corresponding sides are equal in length and all pairs of corresponding angles are equal in measure. Two triangles with identical measures are sometimes said to be identical. Note that for two triangles to have identical measures, all six corresponding measures (i.e., 3 angle measures and 3 length measures) must be the same.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_two_angles_and_the_included_side_condition(self, *args, **kwargs):
        """
        riangles satisfy the two angles and the included side condition if there is a triangle correspondence between the two triangles such that two pairs of corresponding angles are each equal in measure and the pair of corresponding included sides are equal in length.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_two_angles_and_the_side_opposite_a_given_angle_condition(self, *args, **kwargs):
        """
        riangles satisfy the two angles and the side opposite a given angle condition if there is a triangle correspondence between the two triangles such that two pairs of corresponding angles are each equal in measure and one pair of corresponding sides that are both opposite corresponding angles are equal in length.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




    def _problem_two_sides_and_the_included_angle_condition(self, *args, **kwargs):
        """
        riangles satisfy the two sides and the included angle condition if there is a triangle correspondence between the two triangles such that two pairs of corresponding sides are each equal in length and the pair of corresponding included angles are equal in measure.
        
        """
        
        problemTemplate = KProblemTemplate()
        problemTemplate.problem_type = kwargs.get('problem_type')
        
        prob_s = f"""
        TODO
        """
        problemTemplate.add_problem(prob_s.strip(), 'text/html')

        soln_s = f"""
        """
        problemTemplate.add_solution(soln_s.strip(), 'text/html')

        answer_s = f"""
        """
        problemTemplate.add_answer(answer_s.strip(), 'text/html')
        
        return problemTemplate
        pass




