“Cómo tomar la entrada del usuario en una lista en 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 tomar la entrada del usuario en una lista en Python

list1 = []
length = int(input("input the length of your list"))
print("Input values of the list")
for i in range(length):
    values = int(input())
    list1.append(values)
print(list1)
Wandering Warbler

Cómo ingresar en una lista en Python

# Create an empty list
Elements = list()

# Iterating till the range of elements that has to be input
for i in range(0, int(input("Enter the number of elements: "))):
    Elements.append(input("Enter the " + str(i + 1) + " input: ")) # Adding the element to the list 

#Printing the list
print(Elements)
KeshavM05

Respuestas similares a “Cómo tomar la entrada del usuario en una lista en Python”

Preguntas similares a “Cómo tomar la entrada del usuario en una lista en Python”

Más respuestas relacionadas con “Cómo tomar la entrada del usuario en una lista en Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código