Saltar al contenido

devolver el primer elemento en la lista ejemplo de código python

Te damos la bienvenida a nuestra web, aquí vas a hallar la resolución de lo que andabas buscando.

Ejemplo: python obtiene el primer elemento en una lista

# Python3 code to demonstrate  # to get first and last element of list # using list indexing # initializing list  
test_list =[1,5,6,7,4]# printing original list  
print ("The original list is : "+str(test_list))# using list indexing # to get first and last element of list 
res =[ test_list[0], test_list[-1]]# printing result 
print ("The first and last element of list are : "+str(res))

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *