'''
Created on 20-Jan-2022

@author: bthakur
'''

import inspect
import traceback
import random
import numpy as np
from sympy import (latex, Symbol, symbols,
                   Eq, Rational,
                   UnevaluatedExpr as ueval,
                   )

from xv.util import toIntOrFloat, listAttr
from xv.km.storeddata import BaseStoredQuestions
from xv.km import CustomLogarithm as Log
from xv.km.util import latex_log, latex_fraction, latex_exponent

# _grade9_stored_questions
# Grade9StoredQuestions

class Grade9StoredQuestions(BaseStoredQuestions):
    _QUESTION_KEYWORDS = None
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        pass
    
    
    def get_question_percentage(self):
        keywords = [
            'grade9',
            'grade 9',
            'percentage',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        TODO percentage



        The Pines Golf Course is offering free ice cream cones to golfers who hit their tee shot on the green at hole 7! The following bar graph summarizes the tee shots from this morning.
        
        Based on this data, what is a reasonable estimate of the probability that the next tee shot ends up on the green?
        Choose 1 answer:
        (A) $14 \%$
        (B) $17 \%$
        (C) $18 \%$
        (D) $21 \%$
        """
        
        soln_s = rf"""
        When we compute the probability of a future event based on our observations of past events, we call this experimental probability.
		$\displaystyle \text {{ Experimental probability }}=\frac{{\text {{ Number of favorable outcomes }}}}{{\text {{ Total number of outcomes }}}}$
		
		Number of favorable outcomes $=4$
		Total number of outcomes $=4+5+7+3+5=24$ $\displaystyle \frac{{4}}{{24}} \approx 17 \%$
		The probability that the next tee shot ends up on the green is about $17 \%$.
		
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $17 \%$.
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_algebric_equation(self):
        keywords = [
            'grade9',
            'grade 9',
            'algebric_equation',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        $4 x+y=10$
        Complete the missing value in the solution to the equation.
        $( ,-6)$
        """
        
        soln_s = rf"""
        To find the $x$-value that corresponds to $y=-6$, let's substitute this $y$-value in the equation.
		$\begin{{aligned}} 4 x+y &=10 \\ 4 x+(-6) &=10 \\ 4 x-6 &=10 \\ 4 x &=16 \\ x &=4 \end{{aligned}}$
		Therefore $(4,-6)$ is a solution of the equation.
		
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
         $(4,-6)$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_abscissa_ordinate(self):
        keywords = [
            'grade9',
            'grade 9',
            'abscissa_ordinate',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        A point $P$ lies on $x$-axis.
        What can we say about $P$ ?
        Choose 1 answer:
        (A) The abscissa of $P$ is 0 .
        (B) The ordinate of $P$ is 0 .
        (C) P lies on the origin.
        """
            
        soln_s = rf"""
        The abscissa is just a fancy word for $x$-coordinate. Similarly, we can call $y$-coordinate as just ordinate.
        If our point lies on $x$-axis, say $(4,0)$, we would move 0 units along $y$-axis to get there.
        The $y$-coordinate or ordinate of a point lying on $x$-axis is 0 .
                
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        The ordinate of $P$ is 0 .
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_simplify(self):
        keywords = [
            'grade9',
            'grade 9',
            'simplify',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Simplify: $-24 \sqrt{20} \times 10 \sqrt{6}$
        """
            
        soln_s = rf"""
        The expression has both rational and irrational parts. Let's multiply them separately.
		$\begin{{aligned}} &-24 \sqrt{{20}} \times 10 \sqrt{{6}} \\ =&-24 \times 10 \times \sqrt{{20}} \times \sqrt{{6}} \\ =&-240 \times \sqrt{{20 \times 6}} \\ =&-240 \times \sqrt{{2^{{2}} \times 5 \times 6}} \\ =&-240 \times \sqrt{{2^{{2}}}} \times \sqrt{{5 \times 6}} \\ =&-240 \times 2 \times \sqrt{{30}} \\ =&-480 \sqrt{{30}} \\ -& 480 \sqrt{{30}} \end{{aligned}}$

        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $480 \sqrt{{30}}$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_factorize(self):
        keywords = [
            'grade9',
            'grade 9',
            'factorize',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        We're trying to factorize
		$\left(4 x^{{2}}+y^{{2}}+9 z^{{2}}-4 x y-6 y z+12 z x\right)$
		using a suitable algebraic identity.
		This is what we get:
		$(P x-y+Q z)^{{2}}$
		Find the missing values.
		$P=$
		$Q=$
        """
            
        soln_s = rf"""
        To factorize, we would need this identity:
		$a^{{2}}+b^{{2}}+c^{{2}}+2 a b+2 b c+2 c a=(a+b+c)^{{2}}$
		What should we replace $a, b$, and $c$ with to get the expression given in the question?
		If we take $a=2 x, b=-y$ and $c=3 z$, the left-hand side becomes
		$\begin{{aligned}} & a^{{2}}+b^{{2}}+c^{{2}}+2 a b+2 b c+2 c a \\ =&(2 x)^{{2}}+(-y)^{{2}}+(3 z)^{{2}}+2(2 x)(-y)+2(-y)(3 z)+2(3 z)(2 x) \\ =& 4 x^{{2}}+y^{{2}}+9 z^{{2}}-4 x y-6 y z+12 z x \end{{aligned}}$
		This matches our question! Now we need to do the same thing on the right-hand side.
		Plugging the values, we get:
		$(a+b+c)^{{2}}$
		$=(2 x-y+3 z)^{{2}}$
		On comparing,
        $P=2 \text {{ and }} Q=3 \text {{. }}$

        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $P=2 \text {{ and }} Q=3 \text {{. }}$
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_angles(self):
        keywords = [
            'grade9',
            'grade 9',
            'angles',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Todo angles
        
        Find the value of a and b.
        """
            
        soln_s = rf"""
        The green angles are vertically opposite to each other. They're equal.
		The blue angle and one green angle together form a linear pair. They add up to $180^{{\circ}}$.
		$\angle E A C$ is vertically opposite to $\angle B A F$.
		$\begin{{aligned}} \angle E A C &=\angle B A F \\ \angle a+27^{{\circ}} &=85^{{\circ}} \end{{aligned}}$
		$\angle a=58^{{\circ}}$
		$\angle a, \angle b$ and $\angle D A C$ add up to $180^{{\circ}}$.
		So,
		$\angle a+\angle b+\angle D A C=180^{{\circ}}$
		$58^{{\circ}}+\angle b+27^{{\circ}}=180^{{\circ}}$
		$\angle b=95^{{\circ}}$
		So, $\angle a=58^{{\circ}}$ and $\angle b=95^{{\circ}}$.
		
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $\angle a=58^{{\circ}}$ and $\angle b=95^{{\circ}}$.
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_coordinate_system(self):
        keywords = [
            'grade9',
            'grade 9',
            'coordinate_system',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Todo coordinate_system
        
        Point $E$ has an $x$-coordinate that is not 0 , and its $y$-coordinate is negative.
        Where could point $E$ be located on the coordinate plane?
        Choose 2 answers:
        (A) Quadrant I
        (B) Quadrant II
        (C) Quadrant III
        (D) Quadrant IV
        (E) $x$-axis
        (F) $y$-axis
        """
            
        soln_s = rf"""
        
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        Point $E$ could be located in Quadrant III or Quadrant IV.
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_comparision(self):
        keywords = [
            'grade9',
            'grade 9',
            'comparision',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Todo comparision
        
        How many more festivals had 18 to 23 countries represented than 0 to 5 countries represented?
        """
            
        soln_s = rf"""
        
        $4-1=3$
        There were 3 more festivals with 18 to 23 countries represented than with 0 to 5 countries represented.
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        3 festivals
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_algebric_equation_1(self):
        keywords = [
            'grade9',
            'grade 9',
            'algebric_equation_1',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Todo algebric_equation_1
        
        Find x and y.
        """
            
        soln_s = rf"""
        The opposite sides in the given figure are marked as parallel. So, it is a parallelogram
        Let's recall the properties of a parallelogram that can be used here.
        In a parallelogram opposite sides are equal.
        So, $A B=C D$ and $B C=A D$.
        Finding $x$
        $A B=C D$
        $4 x=x+9$
        $3 x=9$
        $x=3$
        Finding $y$
        $B C =A D$
        $2 y-4 =y$
        $y=4$
        Therefore, $x=3$ and $y=4$.

        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $x=3$ and $y=4$.
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_irrational(self):
        keywords = [
            'grade9',
            'grade 9',
            'irrational',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        The decimal expansion of $\sqrt{10}$ is
        Choose 1 answer:
        (A) Non-terminating and non-recurring
        (B) Terminating
        (C) Non-terminating and recurring
        """
            
        soln_s = rf"""
        $\sqrt{{10}}$ is not a rational number, its irrational.
        Hence its decimal expansion will be non-terminating and non-recurring.
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        Non-terminating and non-recurring
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_area_triangle(self):
        keywords = [
            'grade9',
            'grade 9',
            'area_triangle',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Todo area_triangle


        What is the area of the triangle?

        """
            
        soln_s = rf"""
        $\begin{{aligned}} \text {{ Area of triangle }} &=\frac{{1}}{{2}} \times \text {{ base }} \times \text {{ height }} \\ &=\frac{{1}}{{2}} \times 6 \times 15 \\ &=3 \times 15 \\ &=45 \end{{aligned}}$
		The triangle has an area of 45 units $^{{2}}$.
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        45 units $^{{2}}$.
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_congruent_triangle(self):
        keywords = [
            'grade9',
            'grade 9',
            'congruent_triangle',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Todo congruent_triangle


        Consider the two triangles shown below.


        Note: The triangles are not drawn to scale.
        Are the two triangles congruent? 
        Choose 1 answer:
        (A) Yes
        (B) No
        (C) There is not enough information to say
        """
            
        soln_s = rf"""
        Two triangles are congruent if they have the same shape and size. In other words, two triangles are congruent if all corresponding sides and angles are congruent.
		
		However, we do not need to show congruency for all corresponding sides and angles in order to prove that two triangles are congruent. The congruence criteria (SSS, SAS, ASA) and the AAS theorem are useful shortcuts to determine triangle congruence. [What are these?]
		In this case, we are given two angles and a side in each triangle.
		Since the measure of the angles in a triangle sum to $180^{{\circ}}$, we are able to find the remaining angle in each triangle.
		
		Now notice that two angles and the included side in one triangle are congruent to two angles and the included side in another triangle.
		
		Therefore, the two triangles are congruent by ASA.
		Yes, the triangles are congruent.
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        Yes, the triangles are congruent.
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_simplify_1(self):
        keywords = [
            'grade9',
            'grade 9',
            'simplify_1',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Simplify:
        $(5+\sqrt{7})(5-\sqrt{7})$
        """
            
        soln_s = rf"""
        We can use the identity:
		$\begin{{aligned}} (a+b)(a-b)=&a^{{2}}-b^{{2}} \\ =&(5+\sqrt{{7}})(5-\sqrt{{7}}) \\ =& 5^{{2}}-(\sqrt{{7}})^{{2}} \\ =& 25-7 \\ =& 18 \\ (5+\sqrt{{7}})(5-\sqrt{{7}})=&18 \end{{aligned}}$
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        18
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_simplified_fraction(self):
        keywords = [
            'grade9',
            'grade 9',
            'simplified_fraction',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Rewrite as a simplified fraction.
		$1.\overline{{32}}=?$
		"""
            
        soln_s = rf"""
        Let $x$ equal the decimal. Set up two equations such that the digits after the decimal point are identical.
		$\begin{{aligned}}\quad 100 x &=132.3232 \ldots \\ 1 x &=1.3232 \ldots \end{{aligned}}$
		Subtracting the two equations, we have:
		$99 x=131$
		$\displaystyle \quad x=\frac{{131}}{{99}} \quad$ or $\displaystyle \quad 1 \frac{{32}}{{99}}$
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        $\displaystyle \quad x=\frac{{131}}{{99}} \quad$ or $\displaystyle \quad 1 \frac{{32}}{{99}}$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_simplified_fraction_1(self):
        keywords = [
            'grade9',
            'grade 9',
            'simplified_fraction_1',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Which of the following is equivalent to $\displaystyle\frac{{2}}{{\sqrt{{7}}-\sqrt{{3}}}} ?$
		Choose 1 answer:
		(A)$\displaystyle \frac{{1}}{{20}}(\sqrt{{7}}-\sqrt{{3}})$
		(B)$\displaystyle \frac{{1}}{{2}}(\sqrt{{7}}+\sqrt{{3}})$
		(C)$\displaystyle \frac{{1}}{{2}}(\sqrt{{7}}-\sqrt{{3}})$
		(D)$\displaystyle \frac{{1}}{{20}}(\sqrt{{7}}+\sqrt{{3}})$
		"""
            
        soln_s = rf"""
        Here the denominator is irrational.
		So, we can start by converting it to a rational value.
		This can be done by rationalizing $\frac{{2}}{{\sqrt{{7}}-\sqrt{{3}}}}$
		Rationalization
		The complement of $\sqrt{{7}}-\sqrt{{3}}$ is $\sqrt{{7}}+\sqrt{{3}}$.
		On multiplying numerator and denominator with $\sqrt{{7}}+\sqrt{{3}}$ we get,
		$\begin{{aligned}} & \frac{{2}}{{\sqrt{{7}}-\sqrt{{3}}}} \\ =& \frac{{2(\sqrt{{7}}+\sqrt{{3}})}}{{(\sqrt{{7}}-\sqrt{{3}})(\sqrt{{7}}+\sqrt{{3}})}} \\ =& \frac{{2(\sqrt{{7}}+\sqrt{{3}})}}{{(\sqrt{{7}})^{{2}}-(\sqrt{{3}})^{{2}}}} \\ =& \frac{{2(\sqrt{{7}}+\sqrt{{3}})}}{{7-3}} \\ =&\frac{{2}}{{4}}(\sqrt{{7}}+\sqrt{{3}}) \\  =&\frac{{1}}{{2}}(\sqrt{{7}}+\sqrt{{3}}) \end{{aligned}}$
		
		$\displaystyle \frac{{1}}{{2}}(\sqrt{{7}}+\sqrt{{3}})$
		
		
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        $\displaystyle \frac{{1}}{{2}}(\sqrt{{7}}+\sqrt{{3}})$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_mode(self):
        keywords = [
            'grade9',
            'grade 9',
            'mode',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        What is the mode of the following numbers?
        $8,1,2,6,1,4$
        """
            
        soln_s = rf"""
        The mode is the most frequent number.
        There are more 1s than any other number, so 1 is the mode.
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        1
    	"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_root(self):
        keywords = [
            'grade9',
            'grade 9',
            'root',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Which exponential expression is equivalent to $\sqrt[6]{{t}}$ ?
		Choose 1 answer:
		(A) $\displaystyle t^{{\frac{{1}}{{6}}}}$
		(B) $\displaystyle t^{{6}}$
		(C) $\displaystyle \frac{{1}}{{t^{{\frac{{1}}{{6}}}}}}$
		(D) $\displaystyle \frac{{1}}{{t^{{6}}}}$
		
        """
            
        soln_s = rf"""
        This is the definition for a unit-fraction exponent:
		$\displaystyle x^{{\frac{{1}}{{n}}}}=\sqrt[\pi]{{x}}$
		Applying the definition in the reverse direction, we get
		$\displaystyle \sqrt[6]{{t}}=t^{{\frac{{1}}{{6}}}}$
		
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
		$\displaystyle \sqrt[6]{{t}}=t^{{\frac{{1}}{{6}}}}$
    	"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_volume_cone(self):
        keywords = [
            'grade9',
            'grade 9',
            'volume_cone',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        TODO volume_cone
        
        
        Find the volume of the cone.
		Either enter an exact answer in terms of $\pi$ or use $3.14$ for $\pi$ and round your final answer to the nearest hundredth.

        """
            
        soln_s = rf"""
        Volume of a cone $\displaystyle=\pi r^{{2}} \frac{{h}}{{3}}$
		$\displaystyle =\pi \cdot 3^{{2}} \cdot \frac{{2}}{{3}}$
		$\displaystyle =\pi \cdot 9 \cdot \frac{{2}}{{3}}$
		$\displaystyle \begin{{aligned}} &=\frac{{18}}{{3}} \pi \\ &=6 \pi \end{{aligned}}$
		The volume of the cone is $6 \pi$ units $^{{3}}$.
		(Note that we could also multiply 6 by $3.14$ and round our answer to the nearest hundredth to get $18.84$ units $^{{3}}$.)
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        The volume of the cone is $6 \pi$ units $^{{3}}$.

    	"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_probability(self):
        keywords = [
            'grade9',
            'grade 9',
            'probability',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Pepe is going to spin the following spinner 800 times. The spinner is divided into equal sections.
        <img src="https://cdn.kastatic.org/ka-perseus-graphie/8c7770bacffa91e386567d42b6fcc116863d1d72.png">
        Complete the following statement with the best prediction. The spinner will land in the shaded region...
        Choose 1 answer:
        (A) Exactly 160 times
        (B) Close to 160 times but probably not exactly 160 times
        (C) Exactly 640 times
        (D) Close to 640 times but probably not exactly 640 times
        """
            
        soln_s = rf"""
        The best prediction comes from multiplying the total number of trials by the probability of an individual spin landing in the shaded region.
		Best prediction $=$ Number of trials $\times \mathrm{{P}}$ (shaded region)
		Number of trials $=800$
		$\mathrm{{P}}($ shaded region $)=\displaystyle \frac{{4}}{{5}}$
		Best prediction $\displaystyle =800 \times \frac{{4}}{{5}}=640$
		We should not predict exactly how many times the spinner will land in the shaded region because using a spinner is random. It is impossible to make exact predictions for outcomes of random events.
		
		The best prediction is that the spinner will land in the shaded region close to 640 times but probably not exactly 640 times.
		
        
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        Close to 640 times but probably not exactly 640 times
    	"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_polynomials(self):
        keywords = [
            'grade9',
            'grade 9',
            'polynomials',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Which polynomials are in standard form?
        Choose all answers that apply:
        $10-n$
        $5 n+3 n^{3}-1$
        $n+4 n^{2}-7 n^{3}$
        None of the above
        """
            
        soln_s = rf"""
        A polynomial is in standard form if the polynomial's terms are arranged in descending order of degree.
        In conclusion, none of these polynomials are in standard form.

        
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        None of the above
    	"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_graph(self):
        keywords = [
            'grade9',
            'grade 9',
            'graph',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        todo graph


        Graph $-14 x+21 y=84$
        """
            
        soln_s = rf"""
        This is a linear equation given in standard form: $A x+B y=C$. A common way of graphing an equation of this form is to find the $x$ - and $y$-intercepts of the graph.
		To find the $y$-intercept, let's substitute $x=0$ into the equation and solve for $y$ :
		$\begin{{aligned}} -14 x+21 y &=84 \\ -14 \cdot 0+21 y &=84 \\ 21 y &=84 \\ y &=4 \end{{aligned}}$
		So the $y$-intercept is $(0,4)$.
		To find the $x$-intercept, let's substitute $y=0$ into the equation and solve for $x$ :
		$-14 x+21 y=84$
		$-14 x+21 \cdot 0=84$
		$\begin{{array}}{{r}} -14 x=84 \\ x=-6 \end{{array}}$
		So the $x$-intercept is $(-6,0)$.
		
		We can graph the linear equation using these two points, as shown below:
		
        
        {hint_s.strip()}
        """
        
        answer_s = rf"""
    	"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_right_triangle(self):
        keywords = [
            'grade9',
            'grade 9',
            'right_triangle',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Which side lengths form a right triangle?
		Choose all answers that apply:
		(A)$2,2, \sqrt{{4}}$
		(B)$9,40,41$
		(C)$\sqrt{{5}}, 10, \sqrt{{125}}$
		"""
            
        soln_s = rf"""
        (B)$9,40,41$
		
        
        {hint_s.strip()}
        """
        
        answer_s = rf"""
    	(B)$9,40,41$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_factor_polynomial(self):
        keywords = [
            'grade9',
            'grade 9',
            'factor_polynomial',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        Factor the polynomial as the product of three binomials.
		Note: Try using factor theorem for guessing some of the factors.
		$x^{{3}}-9 x^{{2}}+23 x-15=$
		"""
            
        soln_s = rf"""
        We can start by thinking of values of $x$ that make the polynomial equal to 0 .
		Example: If $p(1)=0$, then $(x-1)$ is a factor of $p(x)$.
		Pro tip: A good place to look for such values is in the factors of the constant term, 15 .
		$p(x)=x^{{3}}-9 x^{{2}}+23 x-15$
		
		$15$ has four factors: $1,3,5$, and $15 .$
		$p(1)=1^{{3}}-9 \cdot 1^{{2}}+23 \cdot 1-15=0$
		So, $(x-1)$ is a factor!
		- We can try 3 and 5 as well.
		- Or, we can divide $p(x)$ by $(x-1)$ to get a quadratic.
		
		Dividing $p(x)$ by $(x-1)$ gives us $\left(x^{{2}}-8 x+15\right)$. Let's split the middle term to find the remaining two factors.
		$\begin{{aligned}} & x^{{2}}-8 x+15 \\ =& x^{{2}}-3 x-5 x+15 \\ =& x(x-3)-5(x-3) \\ =&(x-3)(x-5) \end{{aligned}}$
		
		So, $\left(x^{{3}}-9 x^{{2}}+23 x-15\right)$ written as product of its factors looks like:
		$(x-1)(x-3)(x-5)$
		
        
        {hint_s.strip()}
        """
        
        answer_s = rf"""
    	$(x-1)(x-3)(x-5)$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_polynomial_value(self):
        keywords = [
            'grade9',
            'grade 9',
            'polynomial_value',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>

        
        """
        
        prob_s = rf"""
        We have a polynomial $p(k)=1-k^{{2}}+2 k^{{3}}$
		Find the value of $p(2)$.
		"""
            
        soln_s = rf"""
        To find the value of $p(2)$, we need to replace all $k$ by 2 .
		$p(k)=1-k^{{2}}+2 k^{{3}}$
		$p(2)=1-2^{{2}}+2 \cdot 2^{{3}}$
		$=13$
		The value of $p(2)$ is $13 .$
		
        
        {hint_s.strip()}
        """
        
        answer_s = rf"""
    	The value of $p(2)$ is $13 .$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_SAMPLE(self):
        keywords = [
            'grade9',
            'grade 9',
            ]
        
        hint_s = rf"""
        <b>:</b>
        
        """
        
        prob_s = rf"""

        """
        
        soln_s = rf"""

        
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        
        
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass
    
    
    pass
#class Grade9StoredQuestions:
