Skip to content

Instantly share code, notes, and snippets.

@ErikRamses
Created July 1, 2013 07:05
Show Gist options
  • Save ErikRamses/5898886 to your computer and use it in GitHub Desktop.
Save ErikRamses/5898886 to your computer and use it in GitHub Desktop.
Generador py
def repeticiones(todos): #funcion que checa si hay repeticiones
for i in range(len(todos)):
for j in range(len(todos)):
if j!=i:
if todos[i]==todos[j]: #conficion que decide cuando hay una repeticion
print "repetido encontrado: "+str(todos[i]) #Se agrega el valor del numero repetido
return
def random():
import random
x = int(raw_input("Cantidad de numeros a generar: ")) #se piden los numeros a generar
array=list()
todos=list()
b = ''
for i in range(x):
array.append(random.randint(10000, 99999)) #Se generan numeros segun un rango
todos.append(int(array[i])) #Se agregan en la lista todos
repeticiones(todos)
return
def main():
random()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment