Prime number

Python prime number

Hey internet mates here we are going to make a python program to search for the prime number in the list of given numbers.

#creating a vacant list
li=[]
#entering value in list by user
for x in range(10):
    a=int(input("enter number:"))
    li.append(a)
#function for prime
lis=[]
def prime(n):
    for x in range(2,n):
        if n%x==0:
            break
    else:
        lis.append(n)
#function calling statement
for x in range(10):
    prime(li[x])
print("prime numbers are",lis)

2 thoughts on “Prime number”

Leave a Comment

Your email address will not be published. Required fields are marked *