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 ▸

Why would I use dictionaries instead of a list?


How would you get a piece of code to print the numbers 1 to 10


What does __init__ mean?


What is the difference between using range() and a list of values?