Click on http://groups.google.com/group/python-rumo-a-janela/web/problema-1-nmeros-primos
- or copy & paste it into your browser's address bar if that doesn't
work.
#Autor: Rafael Toscano
def Primo(a):
cont = 0
if(a<0):
a = a*(-1)# Caso especial em que os numeros sao negativos
if(a==1): # Caso especial em que o numero é 1
cont = cont + 1
for i in range(2,a):# Demais casos
if(a%i==0):
cont = cont + 1
if(cont>0):
print "Nao primo"
else:
print "Primo"
numero = int(raw_input("Digite um numero: "))
Primo(numero)