def __init__(self): self.type = Types.Equation_First_order_two_unknown self.complexity = Complexity.Basic self.var1, self.var2 = get_two_distinct(['x', 'y', 'z']) self.coef1, self.coef2 = get_two_distinct([2, 3, 4, 5]) self.num1, self.num2 = get_two_distinct([2, 3, 4, 5, 6, 7, 8, 9, 10]) self.res = self.coef1 * self.num1 + self.coef2 * self.num2
def __init__(self): self.type = [Types.Fraction_add, Types.sat_arithmetic] self.complexity = Complexity.Moderate self.subject = random.choice(boys) self.ratio1, self.ratio2 = get_two_distinct(simple_fractions) self.int1, self.int2 = get_two_distinct(range(1, 7)) self.whole = self.int1 + self.int2 self.res = self.ratio1 + self.ratio2
def __init__(self): self.type = Types.Equation_First_order_one_unknown self.complexity = Complexity.Advanced self.arg = random.choice(args) self.const1, self.const2 = descending(*get_two_distinct(consts)) self.coeff1, self.coeff2 = descending(*get_two_distinct(coeff)) self.val = random.choice(values) self.res = self.coeff1 * self.val - self.coeff2 * self.val + self.const1 - self.const2 self.body = "Given {coeff1}{arg} + {const1} - {coeff2}{arg} - {const2} = {res}."\ .format(coeff1=self.coeff1, arg=self.arg, res=self.res, const1=self.const1, coeff2=self.coeff2, const2=self.const2) self.question_text = "What is {arg} ?".format(arg=self.arg)
def __init__(self): self.type = Types.Vehicle_speed_time_distance self.complexity = Complexity.Moderate self.passenger = random.choice(subjects) self.vehicle1, self.vehicle2 = get_two_distinct(fast_vehicles) self.speed1, self.speed2 = get_two_distinct(fast_speeds) self.duration1, self.duration2 = get_two_distinct(duration) self.distance = self.speed1 * self.duration1 + self.speed2 * self.duration2 self.body = "{pas} uses a {veh1} for {dur1} hours than uses a {veh2} for {dur2} hours to travel. The {veh1}'s" \ " speed is {spd1}mph and {veh2}'s speed is {spd2}mph. What is the total distance travelled"\ .format(pas=self.passenger, veh1=self.vehicle1, veh2=self.vehicle2, spd1=self.speed1, spd2=self.speed2 , dur1=self.duration1, dur2=self.duration2)
def __init__(self): self.type = Types.Equation_First_order_one_unknown self.complexity = Complexity.Basic self.subj1, self.subj2 = get_two_distinct(subjects) self.subj1_qty, self.subj2_qty = get_two_distinct(values) self.item = random.choice(items) self.diff = self.subj2_qty - self.subj1_qty self.total = self.subj1_qty + self.subj2_qty self.body = "{subj2} has {qty} many more {item} then {subj1}, If they have {total} {item} in total."\ .format(subj1=self.subj1, qty=self.diff, item=self.item, subj2=self.subj2, total=self.total) self.question_text = 'How many each has? {subj1},{subj2}: '.format( subj1=self.subj1, subj2=self.subj2)
def __init__(self): self.type = Types.Money_Got_Spent_Left self.complexity = Complexity.Advanced self.subject = random.choice(boys) self.item1, self.item2 = get_two_distinct(items) self.ratio1, self.ratio2 = get_two_distinct(random_fractions) self.got = random.choice(range( 2, 11)) * self.ratio1.denominator * self.ratio2.denominator self.body = "{subj} has {got} pounds. He spends {ratio1} of his money on {item1} and then spends {ratio2} of remaining money on {item2}." \ " How much money is he left with?"\ .format(subj=self.subject, ratio1=self.ratio1, ratio2=self.ratio2, item1=self.item1, item2=self.item2, got=self.got) self.res = self.got * (1 - self.ratio1) * (1 - self.ratio2)
def __init__(self): self.type = Types.Percentage self.complexity = Complexity.Advanced self.school = random.choice([200, 300, 400, 500]) self.per1, self.per2 = get_two_distinct([2, 3, 4, 5, 10, 15, 20, 25]) self.lang1, self.lang2 = get_two_distinct([ "German", "Turkish", "Mandarin", "French", "Arabic", "Spanish", "Russian" ]) self.body = "In a school of {school} students, {per1}% of the students study {lang1} and {per2}% of the students study {lang2}."\ "How many of the students study neither of these languages?"\ .format(school=self.school, per1=self.per1, lang1=self.lang1, per2=self.per2, lang2=self.lang2) self.res = self.school * (1 - Fraction(self.per1, 100) - Fraction(self.per2, 100))
def __init__(self): self.type = Types.Money_Got_Spent_Left self.complexity = Complexity.Basic self.subject = random.choice(boys) self.item1, self.item2 = get_two_distinct(items) self.ratio1, self.ratio2 = get_two_distinct(simple_fractions) spent_ratio = self.ratio1 + self.ratio2 self.got = random.choice(range( 2, 11)) * self.ratio1.denominator * self.ratio2.denominator self.spent = self.got * spent_ratio self.body = "{subj} spent {ratio1} of his money on {item1} and {ratio2} of his money on {item2}." \ "If he had {got} pounds, How much money has he spent?"\ .format(subj=self.subject, ratio1=self.ratio1, ratio2=self.ratio2, item1=self.item1, item2=self.item2, got=self.got)
def __init__(self): self.type = Types.Equation_First_order_one_unknown self.complexity = Complexity.Advanced self.ratio1, self.ratio2 = get_two_distinct(random_fractions) self.res = random.choice(range( 2, 10)) * self.ratio1.denominator * self.ratio2.denominator self.got = self.res * self.ratio1 + self.res * self.ratio2
def __init__(self): self.type = Types.Fraction_decimal self.complexity = Complexity.Basic self.pool = [0.1,0.2,0.3,0.5,0.6,0.7,1.0] self.first, self.second = get_two_distinct( self.pool ) self.body = "Represent {0} and {1} as fractions.".format(self.first,self.second) self.res1,self.res2 = Fraction(int(self.first*10),10), Fraction(int(self.second*10),10)
def __init__(self): self.type = Types.Equation_Second_order_one_unknown self.complexity = Complexity.Advanced self.coef1, self.coef2 = get_two_distinct([2, 3, 4, 5]) self.var1 = random.choice(['x', 'y', 'z']) self.num1 = random.choice([2, 3, 4, 5]) self.asked = self.coef1 * self.num1 * self.num1 + self.coef2 * self.num1 * self.num1
def __init__(self): self.type = [Types.Percentage,Types.sat_arithmetic] self.complexity = Complexity.Moderate self.pool = [Fraction(1,2),Fraction(1/4),Fraction(3/4), Fraction(1,10),Fraction(2,5),Fraction(3,5),Fraction(4,5),Fraction(5,5)] self.first, self.second = get_two_distinct( self.pool ) self.res = "{0}%,{1}%".format(str(self.first*100), str(self.second*100)) self.body = "Represent "
def __init__(self): self.type = [Types.General_Problem, Types.sat_reasoning] self.complexity = Complexity.Basic self.source, self.forex = get_two_distinct(['GBP','USD','Euro','TL','Rupee','Yuan','Won']) self.perkm = random.choice([2.3, 3.5, 4.2, 1.8, 0.9, 1.3]) self.km = random.choice([4,5,6,7,8,9,10,13,14,15,16,17,18,20,30,40]) self.res = self.perkm*self.km
def __init__(self): self.type = [Types.Fraction_sub, Types.sat_arithmetic] self.complexity = Complexity.Basic self.first, self.second = descending( *get_two_distinct(random_fractions)) self.res = self.first - self.second self.body = "Calculate "
def __init__(self): self.type = Types.Fraction_decimal self.complexity = Complexity.Moderate self.pool = [0.01,0.02,0.03,0.05,0.16,0.17,1.01, 2.12, 3.14, 5.05] self.first, self.second = get_two_distinct( self.pool ) self.body = "Represent {0} and {1} as fractions.".format(self.first,self.second) self.res1,self.res2 = Fraction(int(self.first*100),100), Fraction(int(self.second*100),100)
def __init__(self): self.type = Types.Money_exchange_rate self.complexity = Complexity.Basic self.source, self.target = get_two_distinct( ['GBP', 'USD', 'Euro', 'TL', 'Rupee', 'Yuan', 'Won']) self.money = random.choice([20, 40, 50, 100, 200, 1000, 2000]) self.exrate = random.choice([2, 4, 5, 10]) self.res = self.money * self.exrate
def __init__(self): self.type = Types.General_Problem self.complexity = Complexity.Moderate self.source, self.target = get_two_distinct(['GBP', 'USD', 'Euro', 'TL', 'Rupee', 'Yuan', 'Won']) self.perkm = random.choice([2.3, 3.5, 4.2, 1.8, 0.9, 1.3]) self.exrate = random.choice([1.2, 1.3, 1.4, 2.3, 2.4, 3.3, 3.4]) self.km = random.choice([4,5,6,7,8,9,10,13,14,15,16,17,18,20,30,40]) self.res = self.perkm*self.km*self.exrate
def __init__(self): self.type = [Types.Money_exchange_rate, Types.sat_reasoning] self.complexity = Complexity.Moderate self.source, self.target = get_two_distinct( ['GBP', 'USD', 'Euro', 'TL', 'Rupee', 'Yuan', 'Won']) self.money = random.choice([20, 40, 50, 100, 200, 1000, 2000]) self.exrate = random.choice([7.8, 2.4, 4.5, 6.7]) self.res = self.money * self.exrate
def __init__(self): self.type = [Types.Percentage, Types.sat_arithmetic] self.complexity = Complexity.Moderate self.first, self.second = get_two_distinct( [2, 5, 10, 20, 25, 30, 40, 50, 60, 75, 90, 100]) self.res1 = Fraction(self.first, 100) self.res2 = Fraction(self.second, 100) self.body = "Represent {0}% and {1}% as fractions".format( self.first, self.second)
def __init__(self): self.type = Types.Decimal self.complexity = Complexity.Advanced self.subj = random.choice(boys) self.dec1, self.dec2 = get_two_distinct([0.1, 0.2, 0.3, 0.4, 0.5]) self.hrs = random.choice([10, 20, 30, 40, 50]) self.body = "{subj} studies a total of {hrs}hours a week. If he studies {dec1} of those hours on maths and {dec2} of those hours on science,"\ "How much time is left for english?".format(subj=self.subj, dec1 = self.dec1, dec2=self.dec2, hrs=self.hrs) self.res = self.hrs * (1 - self.dec1 - self.dec2)
def __init__(self): self.type = Types.Fraction_decimal self.complexity = Complexity.Advanced self.pool = [0.001, 0.123, 0.301, 0.005, 1.001, 1.002, 12.123, 123.456] self.first, self.second = get_two_distinct(self.pool) self.body = "Represent {0} and {1} as fractions.".format( self.first, self.second) self.res1, self.res2 = Fraction(int(self.first * 100), 100), Fraction(int(self.second * 100), 100)
def get_decimal_question(): oper = random.choice(['+', '-']) dec1, dec2 = get_two_distinct([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 1.0]) res = 0.0 if oper == '+': res = dec1 + dec2 if oper == '-': res = dec2 - dec1 body = "{0} {1} {2}".format(dec2, oper, dec1) return res, body
def __init__(self): self.type = Types.Equation_First_order_one_unknown self.complexity = Complexity.Moderate self.arg = random.choice(args) self.num = random.choice([8, 9, 10, 11, 12, 13, 14, 15]) self.const = random.choice(consts) self.coeff1, self.coeff2 = get_two_distinct(coeff) self.res = self.coeff1 * self.num + self.coeff2 * self.num + self.const self.body = "Given {arg}={num} What is {coeff1}{arg} + {coeff2}{arg} + {const}?"\ .format(coeff1=self.coeff1, coeff2=self.coeff2, arg=self.arg, num=self.num, const=self.const)
def __init__(self): self.type = Types.Conversion self.complexity = Complexity.Advanced self.subject = random.choice(girls) self.sack1 = random.choice([1005, 1020, 1034, 1001, 1002, 1432, 1534]) self.sack2 = random.choice([2.20, 2.38, 2.45, 3.6]) self.item1, self.item2 = get_two_distinct( ['potatoe', 'onion', 'tomatoe', 'lentils', 'flour', 'chickpeas']) self.res = self.sack2 * 1000 - self.sack1 self.body="{subj} buys {sack1}gr of {item1} and {sack2}kg of {item2}. What is the weight difference between the two in grams"\ .format(subj=self.subject,sack1=self.sack1,sack2=self.sack2,item1=self.item1, item2=self.item2)
def __init__(self): self.type = Types.Decimal self.complexity = Complexity.Advanced self.oper = random.choice(['+','-','*']) self.dec1,self.dec2 = get_two_distinct([0.001, 0.2, 0.003, 1.04, 2.5, 2.06, 0.01, 0.0, 0.021, 3.002, 3.04, 40.0, 100.001]) if self.oper == '+': self.res = self.dec1 + self.dec2 if self.oper == '-': self.res = self.dec2 - self.dec1 if self.oper == '*': self.res = self.dec1*self.dec2 self.body = "Calculate {0} {1} {2} = ?".format(self.dec2, self.oper, self.dec1)
def __init__(self): self.type = Types.Decimal self.complexity = Complexity.Moderate self.oper = random.choice(['+','-','*']) self.dec1,self.dec2 = get_two_distinct([0.01,0.02,0.03,0.04,0.5,0.6,1.0,2.1,3.2,3.4]) if self.oper == '+': self.res = self.dec1 + self.dec2 if self.oper == '-': self.res = self.dec2 - self.dec1 if self.oper == '*': self.res = self.dec1*self.dec2 self.body = "Calculate {0} {1} {2} = ?".format(self.dec2, self.oper, self.dec1)
def __init__(self): self.type = Types.Simplfy_expression self.complexity = Complexity.Basic self.var1, self.var2 = get_two_distinct(['x', 'y', 'z', 't', 'a', 'b', 'c']) rc = get_unsorted_n_distinct(Question1.coeff, 6) cr = add_plus_sign(rc) # adding + for positive values for representation, keeping them separate from their actual value above. # note we are using first coefficient as is, regardless of its sign, only the positives are marked with + after first one self.q = r'${c1}{v1}{c6}{c2}{v2}{c5}{c3}{v1}{c4}{v2}$'.format(c1=cr[0], v1=self.var1, c2=cr[1], v2=self.var2, c3=cr[2], c4=cr[3], c5=cr[4], c6=cr[5]) rx = add_plus_sign([rc[0]+rc[2], rc[1]+rc[3], rc[4]+rc[5]]) self.res = r'{r1}{v1} {r2}{v2} {r3}'.format(r1=rx[0], v1=self.var1, r2=rx[1], v2=self.var2, r3=rx[2])
def __init__(self): self.type = Types.Equation_First_order_one_unknown self.complexity = Complexity.Moderate self.item = random.choice(items) self.subj1, self.subj2 = get_two_distinct(subjects) self.subj2_qty = random.choice(values) self.coeff = random.choice(coeff) self.subj1_qty = self.coeff * self.subj2_qty self.total = self.subj1_qty + self.subj2_qty self.body = "{subj1} has {coeff} times more {item} than {subj2}. If their total {item} count is {total}."\ .format(subj1=self.subj1, coeff=self.coeff, item=self.item, subj2=self.subj2, total=self.total) self.question_text = 'How many each has? {subj1},{subj2}: '.format( subj1=self.subj1, subj2=self.subj2)
def __init__(self): self.type = Types.Fraction_decimal self.complexity = Complexity.Moderate self.pool = [ Fraction(1, 4), Fraction(3, 4), Fraction(3, 20), Fraction(1, 25), Fraction(49, 50), Fraction(23, 25), Fraction(4, 5) ] self.first, self.second = get_two_distinct(self.pool) self.res = "{0}, {1}".format(float(self.first), float(self.second)) self.body = "Represent "
def __init__(self): self.type = Types.Fraction_decimal self.complexity = Complexity.Basic self.pool = [ Fraction(1, 2), Fraction(2, 2), Fraction(3, 5), Fraction(4, 5), Fraction(1, 10), Fraction(9, 10), Fraction(3, 100), Fraction(13, 100), Fraction(37, 100), Fraction(51, 100) ] self.first, self.second = get_two_distinct(self.pool) self.res = "{0}, {1}".format(float(self.first), float(self.second)) self.body = "Represent "