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 ▸

How do I define a function in Python?


Create an algorithm that can be used as a guessing game. Make sure to import random at the start.


Write a python function that takes a string as parameter and returns the character in the string with the most occurrences, along with the number of times this character occurs


Whats the output of "for i in "hello world": print(i)" and why/how is this achieved