numero = int(input("Ingresa un número: "))

if numero < 0:
    print("No puedes ingresar números negativos.")
elif numero <= 1:
    print("No es primo.")
else:
    primo = True

    for i in range(2, numero):
        if numero % i == 0:
            primo = False
            break

    if primo:
        print("Es primo.")
    else:
        print("No es primo.")

Embed on website

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