“Cómo usar la lista en Python” Código de respuesta

Lista en Python

list = ["string", 69, 6.9, True]
cool dude

Cómo usar la lista en Python

seller = ['apple', 'banana', 'avocado'] # the list
new_item = 'kiwi' # new item in the store
seller.append(new_item) # now it's have been added to the list
LazyGoat

Lista en Python

# List 
a = []
# Dictionary
b = {}
# Tuple
c = ()
# Set
d = {1,2,3}
Frail Falcon

Lista en Python

list = [132, 31212, 12, 2, 12]
print(list[3])
#output: 2
Donald Duck

Lista en Python

list = [1, 2, 3, 4, 5, 6]     
print(list)     
# It will assign value to the value to second index   
list[2] = 10   
print(list)    
# Adding multiple element   
list[1:3] = [89, 78]     
print(list)   
# It will add value at the end of the list  
list[-1] = 25  
print(list)  
Donald Duck

Cómo usar la lista en Python

list1 = [10, 20, 4, 45, 99]
 
mx=max(list1[0],list1[1])
secondmax=min(list1[0],list1[1])
n =len(list1)
for i in range(2,n):
    if list1[i]>mx:
        secondmax=mx
        mx=list1[i]
    elif list1[i]>secondmax and \
        mx != list1[i]:
        secondmax=list1[i]
 
print("Second highest number is : ",\
      str(secondmax))
      
 Output:-     
      
Second highest number is :  45
CodeExampler

Respuestas similares a “Cómo usar la lista en Python”

Preguntas similares a “Cómo usar la lista en Python”

Más respuestas relacionadas con “Cómo usar la lista en Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código