Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solución del reto #34 Python #698

Open
jrgf opened this issue Aug 28, 2022 · 0 comments
Open

Solución del reto #34 Python #698

jrgf opened this issue Aug 28, 2022 · 0 comments

Comments

@jrgf
Copy link

jrgf commented Aug 28, 2022

#Array de prueba
order_array = [2,4,7,9,10,11]
disordered_array = [2,7,4,8,9,10]
repeated_array = [2,2,4,8,9,11]

def faltantes(data):
     primer_item = data[0]
     ultimo_item = data[-1]
     num_faltantes = ultimo_item - primer_item
    


#Error si el array no esta ordenado o tiene valores repetidos
    
    for i in range(1,len(data)):
            #Pruebas al arreglo
            if(data[i-1]>data[i]):
                print('Error: El arreglo no esta ordenado')
                exit() 
            if(data[i-1]==data[i]):
             print('Error: El arreglo tiene caracteres repetidos')
             exit()
    
    
    print('Numeros faltantes : ')
    for i in range(1,num_faltantes):
        print(data[0]+i)

#Prueba #1 Arreglo ordenado
faltantes(order_array)
#Prueba #2 Arreglo desordenado
faltantes(disordered_array)
#Prueba #3 Arreglo con caracteres repetidos
faltantes(repeated_array)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant