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 ▸

Explain why creating a list of several instances of one element using something like my_list = [a] * 5 can result in strange behaviour


Make a program that asks the user for a series of numbers until they either want to output the average or quit the program.


What are the main data structures that I can use in Python


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