Created
July 1, 2013 07:05
-
-
Save ErikRamses/5898886 to your computer and use it in GitHub Desktop.
Generador py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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