Python Program to Check Prime Number

Опубликовано: 05 Октябрь 2024
на канале: CodeLSC
7
0

"Like , Share and Subscribe " #PrimeNumber
---------------------------------------------------------------------------------------------------------------------
Python is a simple, general purpose, high level, and object-oriented programming language.

Python is an interpreted scripting language also. Guido Van Rossum is known as the founder of Python programming.
-----------------------------------------------------------------------------------------------------------------
Python Program to Check Prime Number:
code:
A default function for Prime checking conditions
def PrimeChecker(a):
Checking that given number is more than 1
if a - 1: #note : replace ( - ) by angle brackets
Iterating over the given number with for loop
for j in range(2, int(a/2) + 1):
If the given number is divisible or not
if (a % j) == 0:
print(a, "is not a prime number")
break
Else it is a prime number
else:
print(a, "is a prime number")
If the given number is 1
else:
print(a, "is not a prime number")
Taking an input number from the user
a = int(input("Enter an input number:"))
Printing result
PrimeChecker(a)
---------------------------------------------------------------------------------------------------------------------
#pythonprogram
#learnpython
#quadratic_equation
#Generate_a_Random_Number
#python_equation
#RandomNumber
---------------------------------------------------------------------------------------------------------------------