First Prime Number
You are given
The first line of input is an integer
In the given example of
5 integers
def prime(n):
f = False
if n > 1:
for i in range(2, n):
if (n % i) == 0:
f = True
break
return f
def inputNumbers(n):
count = 1
list1 = []
print('Enter '+str(n) +' numbers: ')
while True:
if count <= n:
d = int(input())
list1.append(d)
else:
break
count += 1
return list1
n =int(input())
list2 = inputNumbers(n)
for i in list2:
if prime(i) == False:
print("The first prime number is: "+str(i))
break
Comments
Leave a comment