Numbers and arithmetic · Python exercise
Decide whether an integer greater than one is prime.
Read an integer and print Prime if it is a prime number, otherwise print Not prime. Numbers below 2 are not prime.
Example 1
Input
17
Output
Prime
Example 2
Input
21
Output
Not prime
21 is divisible by 3 and 7.
How testing works
Your code runs once per test case with that case's standard input. Output is compared after normalising trailing spaces and blank lines at the end. Use input() without a prompt when the exercise expects clean output.
Loading editor…
Press Run tests to execute your code against every input case. Python runs in a Web Worker in your browser.