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)