SQLDAXExcelPython
Leaderboard
Core PythonMedium20 points

Check for primes

Complete is_prime(n) so it returns True for prime numbers. 1 is not prime.

How your answer is tested

After your code, this runs and its result is checked:

result = [n for n in range(0, 40) if is_prime(n)]
Show solutionLifetime

Real Python running in your browser through Pyodide, with pandas available. Nothing you type is sent to a server unless you save a score.

Python
Loading editor…

Press Ctrl+Enter or Run to see the result here.