List of prime numbers from 1-100:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
for i in range(101): #range can be changed upto any positive integer
j=2 #j is the divider
while i%j!=0 or i==2: #checking if (i/j) gives a remainder,
#also if i=2, the loop still runs or else 2 is not considered a prime
j+=1 #increasing j by 1
if j>i/2: #check only dividers(j) of i upto i/2 cause above that ur just reapeating the same factors
print(i,'is a prime')
break #breaks while loop
List of prime numbers from 1-100:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
for i in range(101): #range can be changed upto any positive integer
j=2 #j is the divider
while i%j!=0 or i==2: #checking if (i/j) gives a remainder,
#also if i=2, the loop still runs or else 2 is not considered a prime
j+=1 #increasing j by 1
if j>i/2: #check only dividers(j) of i upto i/2 cause above that ur just reapeating the same factors
print(i,'is a prime')
break #breaks while loop