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 ▸

Which function is ran when an object is instantiated?


Write a recursive function to return the nth Fibonacci number in Python


Write a function that takes a string, and outputs that string formatted in camelcase. (alternating upper and lower case for each character, e.g. cAmElCaSe)


Write a basic program to output the lowest of 3 input numbers. (You may omit error checks on your inputs)