def _generate(self): max_dividend = self.option_get('max_dividend') max_divisor = self.option_get('max_divisor') self.divisor = random_digit(min_val=1, max_val=max_divisor) max_answer = max_dividend / self.divisor self.answer = random_digit(max_val=max_answer) self.dividend = self.divisor * self.answer
def _generate(self): self.start_hours = random_digit(min_val=1, max_val=12) self.start_minutes = random.choice(range(0, 60)) self.delta_hours = random_digit(min_val=1, max_val=12) self.delta_minutes = random.choice(range(0, 60)) self.answer = "%d:%02d" % add_time( self.start_hours, self.start_minutes, -self.delta_hours, -self.delta_minutes)
def _generate(self): max_dividend = self.option_get('max_dividend') max_divisor = self.option_get('max_divisor') self.divisor = random_digit(min_val=1, max_val=max_divisor) self.dividend = random_digit(min_val=self.divisor, max_val=max_dividend) whole_part = self.dividend / self.divisor remainder = self.dividend % self.divisor self.answer = "%dr%d" % (whole_part, remainder)
def _generate(self): self.hours = random_digit(min_val=1, max_val=12) self.minutes = random.choice(range(0, 60, 5)) self.answer = "%d:%02d" % (self.hours, self.minutes)
def _generate(self): self.height = random_digit(min_val=1, max_val=12) self.width = random_digit(min_val=1, max_val=12)
def _generate(self): max_val = self.option_get('max_val') self.a = random_digit(min_val=1, max_val=max_val) self.answer = greatest_factor(self.a)
def _generate(self): max_val = self.option_get('max_val') self.a = random_digit(max_val=max_val) self.b = random_digit(max_val=max_val) self.answer = gcd(self.a, self.b)
def _generate(self): max_val = self.option_get('max_val') self.divisor = random_digit(min_val=1, max_val=max_val) self.dividend = random_digit(min_val=self.divisor, max_val=max_val) self.answer = self.dividend % self.divisor
def _generate(self): self.number = random_digit() self.round_to = random.choice(range(-4, -1)) self.answer = int(round(self.number, self.round_to))
def _generate(self): self.number = random_digit(min_val=1) self.factor = random.choice([10, 100, 10000]) self.direction = random.choice(['up', 'down']) self.answer = find_next_multiple(self.number, self.factor, self.direction)