Practice: Build a List
Practice: Build a List#
Write a function called fun_numbers
that takes a start number and stop number and returns a list of all “fun” numbers between start (inclusive) and stop (exclusive). A number is “fun” if it is divisible by 2 or divisible by 5. The result should have the numbers arranged from smallest to largest.
If there or no fun numbers within the range start
(inclusive) and stop
(exclusive) (e.g. if stop
is less than start
meaning the range doesn’t have any numbers in it), the function should return an empty list.
For example, fun_numbers(2, 16)
should produce the list
[2, 4, 5, 6, 8, 10, 12, 14, 15]
While the call fun_numbers(5, 5)
should produce the empty list: []