+ 1

Write a python program that prints prime number

code is required

18th Dec 2017, 3:57 PM
Hamza Mansoor
7 Answers
+ 9
for num in range(2,101): if all(num%i!=0 for i in range(2,num)): print (num) worked well in my ubuntu terminal..!!
18th Dec 2017, 5:04 PM
Aaditya Deshpande
Aaditya Deshpande - avatar
+ 8
n = int(input()) flag = 0 for i in range(2,n): if(n%i==0): flag = 1 if(flag): print("Number is not prime") else: print("Number is prime")
18th Dec 2017, 5:36 PM
RZK 022
RZK 022 - avatar
19th Dec 2017, 12:52 PM
David Ashton
David Ashton - avatar
+ 3
print([i for i in range(2,100) if not list(filter(lambda j:i%j==0, range(2,i)))]) replace 100 with the max number
19th Dec 2017, 1:27 AM
Ahmad Rafsanjani
Ahmad Rafsanjani - avatar
+ 1
Ultra fast one liner - best for large Ns https://code.sololearn.com/cQq22e5PF7wY/?ref=app
31st Dec 2017, 11:13 AM
VcC
VcC - avatar
+ 1
https://code.sololearn.com/crZkkz38H2Ts/?ref=app
17th Aug 2018, 3:15 PM
Seniru
Seniru - avatar