Пример #1
0
def filter_random_values():
    range_values = loop_range()
    random_values = loop_random_values()
    match_values = []
    for i in random_values:
        if i in range_values:
            match_values.append(i)
    return match_values
Пример #2
0
 def test_range_even_values(self):
     self.assertEqual(loop_range_even(0, 5), [0, 2, 4])
     self.assertNotEqual(loop_range(1, 6), [1, 3, 5])
     # This task is for the particular case of values between 0 and 50:
     self.assertTrue(all(i <= 50 for i in loop_range()))
Пример #3
0
 def test_range_values_iter(self):
     self.assertEqual(loop_range(1, 3), [1, 2])
     self.assertNotEqual(loop_range(2, 3), [1, 2, 3])
     # This task is for the particular case of values between 1 and 50:
     self.assertTrue(all(i != 0 and i <= 50 for i in loop_range()))
Пример #4
0
def gen_filter_random_values():
    range_values = loop_range()
    random_values = loop_random_values()
    for i in random_values:
        if i in range_values:
            yield i