def is_prime(num):
"""Checks if a number is prime or not"""
if num <= 1:
return False
for i in range(2, int(num**0.5)+1):
if num % i == 0:
return False
return True
You can use this function by calling it with a number as an argument. It will return True
if the number is prime, and False
otherwise.
For example, you can check if the number 7 is prime:
>>> is_prime(7)
True
And you can check if the number 15 is prime:
>>> is_prime(15)
False