Iteration
1 / 5
Integer ranges
An number $p > 2$ is prime if it is not divisible by any number $i$ such that $1 < i < p$. A number that is not prime is called composite.
Input a number n
and print prime
or composite
based on whether the value of n
is prime.
Hint: In Python, the operator %
gives remainder after division.
So n
being divisible by i
is equivalent to n%i == 0
.