xxxxxxxxxx
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
xxxxxxxxxx
# Python program to display all the prime numbers within an interval
x = 1
y= 100
for num in range(x,y + 1):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
break
else:
print(num)