+ 1

How can I write a code to find prime numbers in a given list?

10th Jul 2018, 3:16 PM
B.D
B.D - avatar
4 Answers
+ 3
def is_prime(n): if n < 2: return False for i in range(2, int(n ** .5) + 1): if n % i == 0: return False return True num_list = [int(i) for i in input().split() if is_prime(int(i))] print(num_list)
10th Jul 2018, 3:34 PM
Mert Yazıcı
Mert Yazıcı - avatar
10th Jul 2018, 3:22 PM
B.D
B.D - avatar
+ 1
thank you
10th Jul 2018, 3:43 PM
B.D
B.D - avatar
0
What language
10th Jul 2018, 3:22 PM
Paul Grasser
Paul Grasser - avatar