Write a Program in Python to check if a Number is a prime number or not.
# Starting with A default function for finding the Prime number
def PrimeChecker(Number_T4Tutorials):
# finding that given number is more than 1
if Number_T4Tutorials > 1:
# Iterating over the given number with for loop
for j in range(2, int(Number_T4Tutorials/2) + 1):
# If the given number is divisible or not
if (Number_T4Tutorials % j) == 0:
print(Number_T4Tutorials, "is not a prime number.")
break
# otherwise it is a prime number
else:
print(Number_T4Tutorials, "is a prime number")
# If the given number is 1
else:
print(Number_T4Tutorials, "is not a prime number")
# source code to Take an input number from the user by keyboard
Number_T4Tutorials = int(input("Enter an input number:"))
# Displaying the result
PrimeChecker(Number_T4Tutorials)
Output
Enter an input number:4
4 is not a prime number.