Write a function that checks whether a number is prime or not.

Depending on the student level I would accept a simple answer such as: (cannot format code) or expect a more complex answer with optimization such as sieve of Eratosthenes

AC

Related Python Mentoring answers

All answers ▸

Give an example of a FOR loop


Print "Hello World!" ten times without typing (or pasting) the print function more than once


What is the difference between a for loop and a while loop.


Using the shared code editor, write a recursive function for calculating a factorial of an input parameter.