feat: Initial commit
This commit is contained in:
24
Laboratorio4/primi.py
Normal file
24
Laboratorio4/primi.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user