'''
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

# _grade6_stored_questions
# Grade6StoredQuestions

class Grade6StoredQuestions(BaseStoredQuestions):
    _QUESTION_KEYWORDS = None
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        pass
    
    
    def get_question_algebric_equation(self):
        keywords = [
            'grade6',
            'grade 6',
            'algebric_equation',
            ]
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.algebra import SingleVariableManager
        
        """
        
        prob_s = rf"""
        Brandon and Jerry like to play video games. Brandon has $v$ video games, and Jerry has 29 video games. Together they have a total of 73 video games.
        Write an equation to describe this situation.
        """
        
        soln_s = rf"""

        Brandon has an unknown amount of video games, which we're calling $v$, and Jerry has 29 video games. All together, they have 73 video games.
        We can represent the amount of video games that Brandon and Jerry have as a sum: $v+29$
        We know that together they have 73 video games.
        We can set these two expressions equal to describe this situation with an equation: $v+29=73$
        We can also write this as $29+v=73,73=29+v$, or $73=v+29$.
        The equation is $v+29=73$ or any of the equivalent equations above.        

        {hint_s.strip()}

        """
        
        answer_s = rf"""
        The equation is $v+29=73$.
        
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass
    
    
    def get_question_surface_area(self):
        keywords = [
            'grade6',
            'grade 6',
            'surface_area',
            ]
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        TODO surface_area
        
        
        
        Which expression represents the surface area of the prism?
        (A) $12+12+40+30+50$
        (B) $\displaystyle \frac{{1}}{{2}} \cdot 3 \cdot 4 \cdot 10$
        (C) $2 \cdot 6+50+30$
        (D) $6+6+30+40+50$

        """
        
        soln_s = rf"""
        Surface area is a $2 \mathrm{{D}}$ measurement. It tells us the number of square units it would take to cover the faces of the 3D figure.
        [Why not volume?]
        To find the surface area, we need to add the area of each face on the triangular prism.
        We can look at a net of the shape to find the area of each face.
        
        Let's start by finding area of the triangles.
        $\text {{ Area }}=\frac{{1}}{{2}} \times \text {{ base }} \times \text {{ height }}$
        $=\frac{{1}}{{2}} \times 4 \times 3$
        Triangles: 
        $\begin{{aligned}} &=\frac{{1}}{{2}} \times 12 \\ &=6\end{{aligned}}$
        There are two triangle faces with an area of 6 square units. So, we add 6 twice.
        
        Next, let's find the area of each rectangle.
        Area $=$ base $\times$ height
        Left rectangle: $\quad=3 \times 10$
        $=30$
        Area $=$ base $\times$ height
        Center rectangle: $\quad=4 \times 10$
        $=40$
        Right rectangle:
        Area $=$ base $\times$ height
        $
        =5 \times 10$
        
        $=50$
        Finally, we add the area of all 5 faces. The surface area of the triangular prism can be found with the following expression:
        $6+6+30+40+50$
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        $6+6+30+40+50$
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass
    
    
    def get_question_median(self):
        keywords = [
            'grade6',
            'grade 6',
            'median',
            ]
        
        hint_s = rf"""
       
        
        """
        
        prob_s = rf"""
        TODO median
        
        The following frequency table shows the number of trees each person planted at a volunteer event.
        | Number of trees | Number of people |
        | 2 | 1 |
        | 3 | 3 |
        | 4 | 2 |
        | 5 | 1 |
        | 6 | 1 |
        Find the median number of trees planted.        
        
        """
        
        soln_s = rf"""

        The median is the middle data point when the data is sorted from least to greatest.
        In a frequency table, each row can represent several data points. For example, the middle row shows that there are 2 people who each planted 4 trees.
        Let's sort the data points from least to greatest. We have repeats when a row represents more than 1 person. There are 8 total people, so we have 8 numbers of trees.
        $2,3,3,3,4,4,5,6$
        $2,3,3,3,4,4,5,6$
        There is an even number of data points. So the median is the mean of the two middle numbers.
        $\frac{{3+4}}{{2}}=3.5 \text {{ trees }}$
        
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        The median is $3.5$ trees.
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass
    
    
    def get_question_statistics(self):
        keywords = [
            'grade6',
            'grade 6',
            'statistics',
            ]
        
        hint_s = rf"""
        
        
        """
        
        prob_s = rf"""
        TODO statistics
        
        The following table shows the five-number summary for the number of surfers at each beach in Miami.
        | Min | Q_(1) | Median | Q_(3) | Max |
        | 2 | 8 | 13 | 15 | 19 |
        
        What percent of beaches in Miami have 2 or more surfers?
        Choose 1 answer:
        (A) $0 \%$
        (B) $25 \%$
        (C) $50 \%$
        (D) $75 \%$
        (E) $100 \%$       
        
        """
        
        soln_s = rf"""

        Each quartile helps us split the data points into fourths.
        
        | Value | Approximate fraction of data above this value | Approximate percentage of data above this value |
        | Minimum | All | 100% |
        | Q_(1) | (3)/(4) | 75% |
        | Median | (2)/(4), which is (1)/(2) | 50% |
        | Q_(3) | (1)/(4) | 25% |
        | Maximum | None | 0% |
        
        2 surfers is the minimum. So $100 \%$ of the beaches have 2 or more surfers.
        
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        $100 \%$ of beaches in Miami have 2 or more surfers.
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass
    
    
    def get_question_ratio(self):
        keywords = [
            'grade6',
            'grade 6',
            'ratio',
            ]
        
        hint_s = rf"""
        
        
        """
        
        prob_s = rf"""
        TODO ratio
        
        The double number line shows that in 3 seconds an ostrich can run 63 meters.
        Based on the ratio shown in the double number line, how far can an ostrich run in 5 seconds?
                
        """
        
        soln_s = rf"""

        The number lines show that the ratio of seconds of running to distance is $3: 63$.
        We are looking for a ratio that is equivalent to $3: 63$.
        First let's find out how many meters an ostrich can run in 1 second by dividing both parts of the ratio by 3 .
        We can show the distance the ostrich can run In 1 second with the ratio $1: 21$.
        
        Now we can find how far an ostrich can run in 5 seconds by multiplying both parts of the ratio by $5 .$
        
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        In 5 seconds, an ostrich can run 105 meters.
        """

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

    
    def get_question_percentage(self):
        keywords = [
            'grade6',
            'grade 6',
            'percentage',
            ]
        
        hint_s = rf"""
        
        
        """
        
        prob_s = rf"""
        TODO percentage
        
        The square below represents one whole.
        What percent is represented by the shaded area? 
                       
        """
        
        soln_s = rf"""

        Percent means per-hundred.
        Each big square is split into 100 equal pieces, or hundredths.
        So, each of the 100 small squares represent $1 \%$.
        29 hundredths are shaded.
        29 hundredths $=29$ per hundred $=29 \%$
              
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        $29 \%$ is represented by the shaded area.  
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass
    
    def get_question_equations(self):
        keywords = [
            'grade6',
            'grade 6',
            'equations',
            'algebric_expression'
            ]
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.algebra import AlgebricExpressionManager
                
        
        """
        
        prob_s = rf"""
                
        Which expressions are equivalent to $(5 g+3 h+4) \cdot 2$ ?
        Choose all answers that apply:
        (A) $(5 g+3 h) \cdot 8$
        (B) $(5 g+3 h) \cdot 6$
        (C) None of the above    
                           
        """
        
        soln_s = rf"""

        We can play around with the expressions in the answer choices to see if they are the same as $(5 g+3 h+4) \cdot 2$
        
        Let's see if the first expression is equivalent to $(5 g+3 h+4) \cdot 2$.
        $(5 g+3 h) \cdot 8 \stackrel{{?}}{{=}}(5 g+3 h+4) \cdot 2$
        $(5 g+3 h) \cdot 8 \stackrel{{?}}{{=}}(2) 5 g+(2) 3 h+(2) 4$
        $(5 g+3 h) \cdot 8 \stackrel{{?}}{{=}} 10 g+6 h+8$
        $\text {{ (8) }} 5 g+(8) 3 h \stackrel{{?}}{{=}} 10 g+6 h+8$
        $40 g+24 h \neq 10 g+6 h+8$
        
        Let's see if the second expression is equivalent to $(5 g+3 h+4) \cdot 2$.
        $\begin{{aligned}}
        &(5 g+3 h) \cdot 6 \stackrel{{?}}{{=}}(5 g+3 h+4) \cdot 2 \\
        &(5 g+3 h) \cdot 6 \stackrel{{?}}{{=}}(2) 5 g+(2) 3 h+(2) 4 \\
        &(5 g+3 h) \cdot 6 \stackrel{{?}}{{=}} 10 g+6 h+8
        \end{{aligned}}$
        (6) $5 g+(6) 3 h \stackrel{{?}}{{=}} 10 g+6 h+8$
        $30 g+18 h \neq 10 g+6 h+8$
              
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        "None of the above" is the correct answer.
        """

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

    
    def get_question_find_the_value(self):
        keywords = [
            'grade6',
            'grade 6',
            'algebric_expression'
            ]
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.algebra import SingleVariableManager
                
        
        """
        
        prob_s = rf"""
                
        Complete the table for the given rule.
        Rule: $y=\frac{{x}}{{2}}$
        | x | y |
        |  | 1 |
        |  | 2.5 |
        |  | 3.5 |

                           
        """
        
        soln_s = rf"""

        We can substitute 1 for $y$ :
        $1=\frac{{x}}{{2}}$
        
        To find the value of $x$, multiply both sides of the equation by 2 :
        $1 \times 2=\frac{{x}}{{2}} \times 2$
        $2=x$
        
        To find each value of $x$, we need to take each value of $y$ and multiply by 2 .
        
        Let's complete the rest of the table:
        \begin{{aligned}}
        &\begin{{array}}{{cc}}
        x & y \\
        \hline 1 \times 2=2 & 1 \\
        2.5 \times 2=5 & 2.5 \\
        3.5 \times 2=7 & 3.5
        \end{{array}}\\
        
        \end{{aligned}}     
                 
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        &\text {{ The answer is: }}\\
        &\begin{{array}}{{cc}}
        x & y \\
        \hline 2 & 1 \\
        5 & 2.5 \\
        7 & 3.5
        \end{{array}}
        
        """

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

    
    def get_question_complete_the_table(self):
        keywords = [
            'grade6',
            'grade 6',
            'complete_the_table'
            ]
        
        hint_s = rf"""               
        
        """
        
        prob_s = rf"""
        TODO complete_the_table
                        
        Colton has watched 2 comedy movies for every 3 other movies. He has watched 30 total movies.
        Complete the table.
        |  | Original ratio | Number Colton has watched |
        | Comedy movies | 2 |  |
        | Other movies | 3 |  |
        | Total movies |  | 30 |
                           
        """
        
        soln_s = rf"""

        Let's find the total number of movies in the original ratio first.
        Then we can find the value to multiply or divide by to create the equivalent ratio.
        Colton has watched 2 comedy movies for every 3 other movies.
        $2+3=5$
        
        The ratio is made up 5 total movies.
        Let's make an equivalent ratio.
        If we have 6 times as many total movies in the whole, we also need 6 times as many comedy movies.
        Also, we need 6 times as many other movies.
        
        |  | Original ratio | Number Colton has watched |  |
        | Comedy movies | 2 | rarr^(xx6) | ? |
        | Other movies | 3 | rarr^(xx6) | ? |
        | Total movies | 5 | rarr^(xx6)30 |  |
                 
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        This is the completed table.
        |  | Original ratio | Number Colton has watched |
        | Comedy movies | 2 | 12 |
        | Other movies | 3 | 18 |
        | Total movies | 5 | 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_equivalent_ratios(self):
        keywords = [
            'grade6',
            'grade 6',
            'equivalent_ratios'
            ]
        
        hint_s = rf"""               
        
        """
        
        prob_s = rf"""
        TODO equivalent_ratios
                        
        Makoto likes to eat her trail mix piece by piece. For every 5 pieces of nuts she eats, she eats 2 pieces of candy.
        Which of the following could be what Makoto eats from a bag of trail mix?
        
        Choose 2 answers:
        (A) 10 pieces of nuts and 4 pieces of candy
        (B) 15 pieces of nuts and 12 pieces of candy
        (C) 25 pieces of nuts and 20 pieces of candy
        (D) 40 pieces of nuts and 18 pieces of candy
        (E) 45 pieces of nuts and 18 pieces of candy
                           
        """
        
        soln_s = rf"""

        The ratio of the pieces of nuts to the pieces of candy Makoto eats is $5: 2$.
        \begin{{array}}{{llll}}
        \hline \text {{ Nuts }} & 5 & \stackrel{{\times 2}}{{\rightarrow}} & 10 \\
        \hline \text {{ Candy }} & 2 & \stackrel{{\times 2}}{{\rightarrow}} & 4
        \end{{array}}
        
        If she eats 2 times as many pieces of nuts, then she must eat 2 times as many pieces of candy. 
        $10: 4$ is equivalent to $5: 2$
        \begin{{array}}{{lccc}}
        \hline \text {{ Nuts }} & 5 & \stackrel{{\times 9}}{{\rightarrow}} & 45 \\
        \hline \text {{ Candy }} & 2 & \stackrel{{\times 9}}{{\rightarrow}} & 18
        \end{{array}}
        If she eats 9 times as many pieces of nuts, then she must eat 9 times as many pieces of candy. 
        $45: 18$ is equivalent to $5: 2$.

                
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        Makoto could eat the following from a bag of trail mix:
        - 10 pieces of nuts and 4 pieces of candy
        - 45 pieces of nuts and 18 pieces of candy
                
        """

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

    def get_question_arithmetic_operation(self):
        keywords = [
            'grade6',
            'grade 6',
            'arithmetic_operation'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.basicmaths import ArithmeticOperationManager
        """
        
        prob_s = rf"""
        Evaluate.
        $2+2 \div 2=$

                           
        """
        
        soln_s = rf"""

        Strategy
        We need to agree on a set of rules so anyone would get the same value when they evaluate the same expression.
        - First, we evaluate operations inside of grouping symbols. 
        - Next, we evaluate any exponents (not covered in this exercise).
        - Then, we calculate multiplication and division.
        - Last, we calculate addition and subtraction.

        Step-by-step
        $2+2 \div 2$ Divide $2 \div 2$ first.
        $=2+1 \quad$ Add
        $=3$
        
                
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        Answer
        $2+2 \div 2=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_inequality(self):
        keywords = [
            'grade6',
            'grade 6',
            'inequality'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.basicmaths import ArithmeticInequalityManager
        """
        
        prob_s = rf"""
        Graph $x>2$
        Switch direction Make circle open
                           
        """
        
        soln_s = rf"""

        The $>$ symbol means "greater than and not including".
        A filled circle means "including this number".
        An open circle means "not including this number".
        
        $x>2$ does not include 2 . We can draw an open circle at 2 .
                
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        Numbers to the right of 2 are greater than 2 . We can draw an arrow to the right of the circle.
        The graph of $x>2$ is:        
                
        """

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


    def get_question_frequency_table(self):
        keywords = [
            'grade6',
            'grade 6',
            'frequency_table'
            ]
        
        hint_s = rf"""     
        
        """
        
        prob_s = rf"""
        TODO frequency_table
        
        The following dot plot shows the number of books each student checked out from the library last month. Each dot represents a different student.
        
        Number of books
        
        Which of the following is a typical number of books one student checked out?
        Choose 1 answer:
        (A) 1 book
        (B) 4 books
        (C) 7 books
        (D) 12 books                           
        """
        
        soln_s = rf"""

        There are lots of ways we can think about the typical number of books.
        - What was the most common number of books?
        - If we split the books evenly among all the students, how many books would each student have?
        - What would be the balance point of the data?
        - What is the middlemost number of books?
        
        The most students had 8 books, but the second most had 4 books.
        
        If we split the books evenly, each student would have 6 or 7 books.
        
        If we put our dot plot on a balance scale, it would balance when the pivot was close to 6 books.                

        The scale would tip if, for example, we put the pivot at 12 books.
        
        About half of the students checked out 6 or fewer books and about half checked out 7 or more books.

        {hint_s.strip()}

        """
        
        answer_s = rf"""
        Of the choices, it is reasonable to say that a student typically checked out about 7 books.        
                
        """

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

    def get_question_plotting(self):
        keywords = [
            'grade6',
            'grade 6',
            'plotting'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.geometry import BasicPlottingManager
                
        """
        
        prob_s = rf"""
        
        The upper-left coordinates on a rectangle are $(-6,0)$, and the upper-right coordinates are $(-4,0)$. The rectangle has an area of 12 square units.
        
        Draw the rectangle on the coordinate plane below.
        
        """
        
        soln_s = rf"""

        Let's draw the two coordinates we know:
        
        The distance between the points is 2 units.
        Let's use this information to find the width.
        Area $=$ length $\times$ width
        $12=2 \times$ width
        $12 \div 2=$ width
        $6=$ width
        The rectangle has a width of 6 units.
        
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        Now we can draw the lower-right and lower-left coordinates 6 units below the existing coordinates:
        
        """

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

    def get_question_inequality_2(self):
        keywords = [
            'grade6',
            'grade 6',
            'inequality_2'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.basicmaths import ArithmeticInequalityManager
                
        """
        
        prob_s = rf"""
        We want the following inequality to be true:
        $|x|>|-10|$
        Which of the following are possible values for $x$ ?
        Choose all answers that apply:
        (A) $x=-17$
        (B) $x=-1$
        (C) $x=11$        

        """
        
        soln_s = rf"""

        The inequality $|x|>|-10|$ means that $x$ is farther away from 0 than $-10$ is.
        All numbers less than $-10$ and all numbers greater than 10 are farther away from 0 than $-10$ is.
        $-17$ and 11 are farther from 0 than $-10$ is.
        
        We can also plug in each number for $x$ to see if the inequality is true:
        $$
        \begin{{aligned}}
        |-17| &>|-10| \\
        17 &>10 \\
        
        |-1| &>|-10| \\
        1 &>10 \\
        
        |11| &>|-10| \\
        11 &>10
        \end{{aligned}}
        $$
        
                
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        $-17$ and 11 are possible values for $x$.

        """

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


    def get_question_distributive_property_over_addition(self):
        keywords = [
            'grade6',
            'grade 6',
            'distributive_property_over_addition'
            ]
        
        hint_s = rf"""     
        
                
        """
        
        prob_s = rf"""
        TODO: distributive_property_over_addition
        
        Apply the distributive property to factor out the greatest common factor.
        $25 p+50 q=$       

        """
        
        soln_s = rf"""

        Let's find the greatest common factor of 25 and $50 .$
        
        25 is the greatest common factor of 25 and 50 .
        $$
        \begin{{aligned}}
        & 25 p+50 q \\
        =& 25\left(\frac{{25 p}}{{25}}+\frac{{50 q}}{{25}}\right) \\
        =& 25(p+2 q)
        \end{{aligned}}
        $$ 
                
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        25(p+2q)

        """

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


    def get_question_power(self):
        keywords = [
            'grade6',
            'grade 6',
            'power'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.basicmaths import PowerManager
                
        """
        
        prob_s = rf"""
        
        Evaluate.
        $\left(\frac{{1}}{{5}}\right)^{{2}}=$   

        """
        
        soln_s = rf"""

        An exponent tells us how many factors of the base we should multiply to find the value of an expression.
        
        For example, we can take the power of a fraction like this:
        $\begin{{aligned}}
        \left(\frac{{2}}{{3}}\right)^{{2}} &=\frac{{2}}{{3}} \cdot \frac{{2}}{{3}} \\
        &=\frac{{2 \cdot 2}}{{3 \cdot 3}} \\
        &=\frac{{4}}{{9}} \\
        \left(\frac{{1}}{{5}}\right)^{{2}} &=\frac{{1}}{{5}} \cdot \frac{{1}}{{5}} \\
        &=\frac{{1 \cdot 1}}{{5 \cdot 5}}
        \end{{aligned}}$
           
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        $\left(\frac{{1}}{{5}}\right)^{{2}}=\frac{{1}}{{25}}$

        """

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


    def get_question_lcm(self):
        keywords = [
            'grade6',
            'grade 6',
            'lcm'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.basicmaths import LcmManager
                
        """
        
        prob_s = rf"""
        
        What is the least common multiple of 4 and 8 ?
        $\operatorname{{lcm}}(4,8)=$

        """
        
        soln_s = rf"""

        The least common multiple is the smallest number that is a multiple of 4 and 8 .
        
        We know that $8 \times 4$ (or 32 ) is a common multiple, but is it the least common multiple?
        
        Write out the multiples of 8 until we find a number divisible by 4 .
        
        8
        
        So, the least common multiple of 4 and 8 is $8 .$
           
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        The least common multiple of 4 and 8 is $8 .$

        """

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


    def get_question_describe_the_inequality(self):
        keywords = [
            'grade6',
            'grade 6',
            'describe_the_inequality'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.basicmaths import ArithmeticInequalityManager            
        """
        
        prob_s = rf"""
        
        Emoji were first introduced on Japanese mobile phones in the year $1997 .$
        Write an inequality that describes $y$, the years before emoji were introduced. 
        
        Enter your inequality without a thousands separator.
        """
        
        soln_s = rf"""

        "Before" a certain year refers to the years that are less than that year.
        Since $y$ represents the years before $1997, y$ is less than 1997 .
               
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        $y<1997$    

        """

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


    def get_question_differentiation(self):
        keywords = [
            'grade6',
            'grade 6',
            'differentiation'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.calculus import DifferentiationBasicsManager            
        """
        
        prob_s = rf"""
        
        The price per night for a hotel room is different at three different hotels.
        $\begin{{array}}{{ccc}}
        \text {{ Hotel }} & \text {{ Nights }} & \text {{ Price (in dollars) }} \\
        \hline A & 3 & 192 \\
        B & 5 & 300 \\
        C & 7 & 455
        \end{{array}}$
        Which hotel costs the least per night?
        Choose 1 answer:
        (A) Hotel $A$
        (B) Hotel $B$
        (C) Hotel $C$
        """
        
        soln_s = rf"""

        We are trying to find a unit rate, specifically the price per 1 night.
        $\frac{{\text {{ total price }}}}{{\text {{ nights }}}}=$ price per night
        We can compare from the largest to the smallest place value.
        
        Finding the unit rates
        
        We divide based on the unit rate we want, not the order of the columns in the original table.
        $\begin{{array}}{{lccccc}}
        \text {{ Hotel }} & \text {{ Price }} & & \text {{ Nights }} & & \text {{ Price per night }} \\
        \hline A & 192 & \div & 3 & = & 64 \\
        B & 300 & \div & 5 & = & 60 \\
        C & 455 & \div & 7 & = & 65
        \end{{array}}$

        Comparing the unit rates
        $\begin{{array}}{{ccc}}
        \text {{ Hotel }} & \text {{ Tens }} & \text {{ Ones }} \\
        \hline A & 6 & 4 \\
        B & 6 & 0 \\
        C & 6 & 5
        \end{{array}}$
        
        The hotels all cost 6 tens of dollars per night, but hotel B costs the least ones of dollars per night.
        
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        Hotel $B$ costs the least per night.
           

        """

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


    def get_question_plot_the_point(self):
        keywords = [
            'grade6',
            'grade 6',
            'plot_the_point'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.geometry import BasicPlottingManager            
        """
        
        prob_s = rf"""
        
        Which point is located at $-8.65$ ?
        Choose 1 answer:
        (A) Point $A$
        (B) Point $B$
        (C) Point $C$
        (D) Point $D$

        """
        
        soln_s = rf"""

        $-8.65$ is between $-9$ and $-8$.
        $-8.65$ is between $-8.7$ and $-8.6$.
        In summary
        Point $B$ shows $-8.65$.  
              
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        Point $B$ shows $-8.65$.   
        """

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


    def get_question_identify_the_shape(self):
        keywords = [
            'grade6',
            'grade 6',
            'identify_the_shape'
            ]
        
        hint_s = rf"""     

        """
        
        prob_s = rf"""
        TODO: identify_the_shape
        
        Identify the 3D shape shown below.
        Choose 1 answer:
        (A) Cone
        (B) Cylinder
        (B) Sphere
        
        """
        
        soln_s = rf"""

        A cone has one circular base joined to a curved side that ends in a point.
        The shape above does not have a circular base. So the shape is not a cone.
        
        A cylinder has two parallel circular bases connected by a curved surface.
        The shape above does not have circular bases. So, the shape is not a cylinder.
        
        A sphere is a round solid figure with every point on its surface equidistant from its center.
        The shape above matches this description.
         
              
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        The shape is a sphere.    
        """

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


    def get_question_mean_absolute_deviation(self):
        keywords = [
            'grade6',
            'grade 6',
            'mean_absolute_deviation'
            ]
        
        hint_s = rf"""     
        
        """
        
        prob_s = rf"""
        TODO: mean_absolute_deviation
        
        Find the mean absolute deviation (MAD) of the data in the dot plot below.
        goals ....
        Lottie's lacrosse scoring  in each season
        
        """
        
        soln_s = rf"""

        The mean absolute deviation (MAD) is the mean of the distances from the mean.
        
        First, let's find the mean.
        $\frac{{22+23+23+25+27}}{{5}}=\frac{{120}}{{5}}=24$ goals
        
        Next, let's find the distance each data point is from the mean.
        Data point Distance from the mean
        $\begin{{array}}{{ll}}22 & 24-22=2 \\ 23 & 24-23=1 \\ 23 & 24-23=1 \\ 25 & 25-24=1 \\ 27 & 27-24=3\end{{array}}$
        
        Finally, we find the mean of the distances from the mean. $\frac{{2+1+1+1+3}}{{5}}=\frac{{8}}{{5}}=1.6$ goals
              
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        The mean absolute deviation of the number of goals is $1.6$ goals.         
           
        """

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


    def get_question_clusters(self):
        keywords = [
            'grade6',
            'grade 6',
            'clusters'
            ]
        
        hint_s = rf"""     

        """
        
        prob_s = rf"""
        TODO: clusters
        
        Here's a dot plot showing the gas mileage of each car at Miley's Motors.
        Leticia wants to describe the gas mileage distribution in terms of its clusters, gaps, and peaks.
        Which of these statements could Leticia use?
        
        Choose all answers that apply:
        A There is a cluster from 33 to 37 miles per gallon.
        B) There is a gap from 38 to 42 miles per gallon.
        (C) None of the above
        
        """
        
        soln_s = rf"""

        - A peak is where the distribution is tall, like the peak of a mountain.
        - A gap is a space in the distribution without data.
        - A cluster is where data points huddle together in a group.
        Let's use these to think about which statements Leticia could use.
        
        The distribution does not have a cluster from 33 to 37 miles per gallon. It has a gap instead!
        
        The distribution does not have a gap from 38 to 42 miles per gallon. It has a cluster instead!
                      
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        Leticia could use none of the statements.         
           
        """

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


    def get_question_division(self):
        keywords = [
            'grade6',
            'grade 6',
            'division'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.basicmaths import ArithmeticExpressionManager
        
        """
        
        prob_s = rf"""
        Divide. Write the quotient in lowest terms.
        $1 \frac{{1}}{{4}} \div 1 \frac{{2}}{{5}}=$

        
        """
        
        soln_s = rf"""

        First, let's rewrite $1 \frac{{1}}{{4}}$ and $1 \frac{{2}}{{5}}$ as fractions:
        $1 \frac{{1}}{{4}} \div 1 \frac{{2}}{{5}}=\frac{{5}}{{4}} \div \frac{{7}}{{5}}$
        
        Dividing by a fraction is the same as multiplying by the reciprocal of the fraction.
        The reciprocal of $\frac{{7}}{{5}}$ is $\frac{{5}}{{7}}$.
        
        Now, we can rewrite our expression as a multiplication problem:
        $\begin{{aligned}}
        &\frac{{5}}{{4}} \div \frac{{7}}{{5}}=\frac{{5}}{{4}} \times \frac{{5}}{{7}} \\
        &=\frac{{5 \times 5}}{{4 \times 7}} \\
        &=\frac{{25}}{{28}}
        \end{{aligned}}$ 
                             
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        $=\frac{{25}}{{28}}$       
           
        """

        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(self):
        keywords = [
            'grade6',
            'grade 6',
            'coordinate'
            ]
        
        hint_s = rf"""     
        <b>See the following managers for more detailed explanation:</b>
        from xv.math.geometry import BasicPlottingManager  
        
        """
        
        prob_s = rf"""
        Jing graphs the amount of time it takes her to get to work in the last two weeks. The $x$-axis of the graph represents the number of days before today. For example, $-1$ would represent yesterday. The $y$-axis represents the commute time in minutes.
        
        """
        
        soln_s = rf"""

        The $x$-axis represents the day relative to today, and the $y$-axis represents the minutes it took Jing to get to work each day.
        We need to find the point that represents a 22 minute commute time.
        
        We know the number of minutes is along the $y$-axis, so we need to move 22 spaces above 0 .
        
        Now, we look at the $x$-axis to find how many days ago Jing's commute took 22 minutes.
        $(-7,22)$
        It happened 7 days ago.

        {hint_s.strip()}

        """
        
        answer_s = rf"""
        It took Jing 22 minutes to get to work 7 days ago.                             
       
        """

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


    def get_question_histogram(self):
        keywords = [
            'grade6',
            'grade 6',
            'histogram'
            ]
        
        hint_s = rf"""     
        
        """
        
        prob_s = rf"""
        TODO: histogram
        
        Guests in each hostel room
        How many hostel rooms are there?
        """
        
        soln_s = rf"""

        We simply need to add up the height of each bar. $3+5+8+6+2+1=?$
        There are 25 hostel rooms.
        
        {hint_s.strip()}

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

        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 = [
            'grade6',
            'grade 6',
            ]
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</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 Grade6StoredQuestions:
