“Como obter a entrada do usuário em uma lista no Python” Respostas de código

Obtenha a entrada da lista do usuário no python

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

Como obter a entrada do usuário em uma lista no 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

Como inserir uma lista em 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

Respostas semelhantes a “Como obter a entrada do usuário em uma lista no Python”

Perguntas semelhantes a “Como obter a entrada do usuário em uma lista no Python”

Procure respostas de código populares por idioma

Procurar outros idiomas de código