Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def es_primo(n):
- if (n==1):
- return False
- elif (n==2):
- return True;
- else:
- for x in range(2,n):
- if(n % x==0):
- return False
- return True
- def intervalo_primos(a,b):
- array_primos = []
- for i in range(a,b):
- if es_primo(i):
- array_primos.append(i)
- return array_primos
- lista = intervalo_primos(2,10)
- print lista
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement