# Funzione che verifica se un numero è primo
def is_prime(G):
    # Se il numero è inferiore a 2 non è primo
    if G < 2:
        return False
    
    # Verificare se un numero è divisibile da 2 fino alla radice quadrata del numero
    for i in range(2, int(G**0.5) + 1):
        if G % i == 0:
            return False
    
    # Se non è stato trovato nessun divisore il numero è primo
    return True

for number in range(2, 1000):
    # Se il numero corrente è primo stampalo
    if is_prime(number):
        print(number)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: