solutions

# Divisible numbers comprehension with multiple terms

Write a function that receives a list of numbers and a list of terms and returns only the elements that are divisible by ALL the terms. You must use two nested list comprehensions to solve it.

``divisible_numbers([12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [2, 3]) == [12, 6]``

### Test Cases

test empty list -

``````def test_empty_list():
assert divisible_numbers([], [5, 7]) == []
``````

test many divisible numbers -

``````def test_many_divisible_numbers():
result = divisible_numbers([12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [2, 3])
expected = [12, 6]

assert result == expected
``````

test no result -

``````def test_no_result():
assert divisible_numbers([2, 4, 8], [5, 7]) == []
``````

test one divisible numbers -

``````def test_one_divisible_numbers():
result = divisible_numbers([16, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [2, 3, 4])
assert  result == [12]
``````

test both empty lists -

``````def test_both_empty_lists():
assert divisible_numbers([], []) == []
``````