prime number program in python
Here is a sample Python program that checks if a given number is a prime number: python Copy code def is_prime(n): if n <= 1: return False for i in range(2, int(n**(1/2))+1): if n % i == 0: return False return True num = int(input("Enter a number: ")) if is_prime(num): print(num, "is a prime number.") else: print(num, "is not a prime number.") This program takes an input from the user, and checks if that number is prime by dividing it by all integers greater than 1 and less than the square root of that number, if the number is divisible by any of the integers it returns not a prime number otherwise it returns prime number.