示例#1
0
 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
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 def _generate(self):
     self.height = random_digit(min_val=1, max_val=12)
     self.width = random_digit(min_val=1, max_val=12)
示例#6
0
 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)
示例#7
0
 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)
示例#8
0
 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
示例#9
0
 def _generate(self):
     self.number = random_digit()
     self.round_to = random.choice(range(-4, -1))
     self.answer = int(round(self.number, self.round_to))
示例#10
0
 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)