Answer to Question #258774 in Python for Pavani

Question #258774

write a program to print the first prime number in the given inputs .


1
Expert's answer
2021-10-30T00:38:15-0400
n = int(input("Enter number of integers: "))
numbers = []


for ​i in range(n):
​number = int(input("Enter number: "))
​isPrime=True
​if number > 1:
​for j in range(2, number):
​if (number % j) == 0:
​isPrime=False
​break
​if isPrime==True:
​numbers.append(number)
​
print("The first prime number in the given inputs is: "+str(numbers[0])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog