“Agregue la entrada a la lista de Python” Código de respuesta

Obtenga la entrada de la lista del usuario en Python

a = list(map(int,input("\nEnter the numbers : ").strip().split()))
Faithful Flamingo

Cómo obtener la entrada del usuario de la lista en Python

# number of elements 
n = int(input("Enter number of elements : ")) 
  
# Below line read inputs from user using map() function  
a = list(map(int,input("\nEnter the numbers : ").strip().split()))[:n] 
  
print("\nList is - ", a)
Bright Butterfly

Cómo obtener la entrada del usuario de la lista de listas en Python

lst = [ ] 
n = int(input("Enter number of elements : ")) 
  
for i in range(0, n): 
    ele = [input(), int(input())] 
    lst.append(ele) 
      
print(lst)
Bright Butterfly

Agregue la entrada a la lista de Python


shopList = [] 
maxLengthList = 6
while len(shopList) < maxLengthList:
    item = input("Enter your Item to the List: ")
    shopList.append(item)
    print shopList
print "That's your Shopping List"
print shopList

Elegant Eel

Agregue la entrada a la lista de Python

1print("hello")
2
3
5
6
7
8
9
3



Testy Tern

Respuestas similares a “Agregue la entrada a la lista de Python”

Preguntas similares a “Agregue la entrada a la lista de Python”

Más respuestas relacionadas con “Agregue la entrada a la lista de Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código