Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/12/2011, 15:36
Avatar de _cronos2
_cronos2
Colaborador
 
Fecha de Ingreso: junio-2010
Mensajes: 2.062
Antigüedad: 13 años, 11 meses
Puntos: 310
Respuesta: ¿Qué estoy haciendo mal en este ejercicio?

A ver así:
Código Python:
Ver original
  1. def es_primo(n):
  2.     for i in range(2, n):
  3.         if not (n % i):
  4.              return True
  5.     return False
  6.  
  7. lista = []
  8.  
  9. for i in range(2, num + 1):
  10.     es_primo(i) and lista.append(i)
Saludos (:
__________________
" Getting older’s not been on my plans
but it’s never late, it’s never late enough for me to stay. "
Cigarettes - Russian Red

Última edición por _cronos2; 09/12/2011 a las 16:15