Created
December 26, 2019 12:28
-
-
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.
This file contains hidden or 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
# 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