Check Number is Prime or Not Prime in a List using Python | List Number is Prime or Not Prime using Python
In this Post We Check Number is Prime or Not Prime in a List using Python Very Simple Example
Output:
Program Source Code:
myList = [7,8,9,4,3,13,17,22,23]
l = len(myList)
for i in range(0 , l):
c = 0
for j in range(2,myList[i]):
if myList[i]%j == 0:
c=1
break
if c == 0:
print(myList[i], " is prime
number")
else:
print(myList[i], " is Not Prime")
Related Video
Post a Comment