← Back to challenges

Primes Below a Given Number

PythonHardalgebramathnumbersloops

Instructions

Create a function that will find all primes below a given number. Return the result as a list.

Examples

primes_below_num(5) ➞ [2, 3, 5]

primes_below_num(10) ➞ [2, 3, 5, 7]

primes_below_num(20) ➞ [2, 3, 5, 7, 11, 13, 17, 19]

Notes

If n is a prime, include it in the list.

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