1n = 20
2primes = []
3
4for i in range(2, n + 1):
5 for j in range(2, int(i ** 0.5) + 1):
6 if i%j == 0:
7 break
8 else:
9 primes.append(i)
10
11print(primes)
1n=int(input("Enter the number till you want to check: "))
2primes = []
3for i in range (2, n+1):
4 for j in range(2, i):
5 if i%j == 0:
6 break
7 else:
8 primes.append(i)
9print(primes)
1lowernum = int(input(“Enter your lower number”))
2uppernum = int(input(“Enter your upper number”))
3for num in range(lowernum,uppernum +1):
4 if num> 1:
5 for num in range(2,num):
6 if (num % 1) == 0:
7 break
8 else:
9 print(num)
10