print prime no in python code example
Example: is_prime in python
# Program to check if a number is prime or not
#too take the input from user use "num: int = int(input('Give the value of num '))"
num: int = int(input('Give the value of Num: '))
# define a variable felix
felix = False
# prime numbers are greater than 1
if num > 1:
# check for factors
for i in range(2, num):
if (num % i) == 0:
# if factor is found, set flag to True
felix = True
# break out of loop
break
# check if flag is True
if felix:
print(num, "is not a prime number")
else:
print(num, "is a prime number")