← Back to challenges

List Operation

PythonHardarraysnumbersmath

Instructions

Create a function that takes three parameters where:

  • x is the start of the range (inclusive).
  • y is the end of the range (inclusive).
  • n is the divisor to be checked against.

Return an ordered list with numbers in the range that are divisible by the third parameter n. Return an empty list if there are no numbers that are divisible by n.

Examples

list_operation(1, 10, 3) ➞ [3, 6, 9]

list_operation(7, 9, 2) ➞ [8]

list_operation(15, 20, 7) ➞ []

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Simon Says