Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created December 26, 2019 12:28
Show Gist options
  • Save Fhernd/fa51dc08be5feebb388667f995003cd3 to your computer and use it in GitHub Desktop.
Save Fhernd/fa51dc08be5feebb388667f995003cd3 to your computer and use it in GitHub Desktop.
# Ejercicio 427: Crear una función para remover un elemento de un objeto tupla.
# Ejercicio 427: Crear una función para remover un elemento de un objeto tupla.
def remover_elemento(tupla, i):
if 0 <= i < len(tupla):
return tupla[0:i] + tupla[i+1:]
raise ValueError('i está por fuera del rango.')
numeros = (2, 3, 5, 7)
indice = 1
resultado = remover_elemento(numeros, indice)
print(numeros)
print(resultado)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment