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 ▸

Manually implement a function that finds the smallest value in a list of integers and print it.


Ask the user for a number and output the smallest divisor, bigger than one, for the inputted number. Output "Prime" if the number is a prime number.


Why are negative indexes used?


Create a program that takes in two numbers and returns the highest of the two