25 lines
368 B
Python
25 lines
368 B
Python
import random
|
|
|
|
primeList = []
|
|
|
|
|
|
def primeListGenerator(upperBound):
|
|
global primeList
|
|
|
|
for i in range(2, upperBound):
|
|
isPrime = True
|
|
|
|
for primeNumber in primeList:
|
|
if i % primeNumber == 0:
|
|
isPrime = False
|
|
break
|
|
|
|
if isPrime:
|
|
primeList.append(i)
|
|
|
|
|
|
n = int(input("Fino a "))
|
|
primeListGenerator(n)
|
|
for n in primeList:
|
|
print(n)
|