-2
I want to create a list where the user sets the amount of items in the list and asks the user for each item in the list.
I did it that way:
n = int(input("Digite a quantidade de células da sua lista: "))
cont = 1
lista = []
for i in range(n):
lista += (input("Informe o valor de x%d: " % (i+1)))
vetor_original = lista
print(f"Vetor Original {vetor_original}")
In the print appears Our list is [appears the elements within 'x']
And I wanted you to show up without ''
Search for the
append
from the Python list.– Woss
I managed to do it one way, but I still have a little problem
– Lary
And you will describe it in the question?
– Woss
updated the question showing how it is now
– Lary
lista += input(...)
, you are creating a list of strings, so the quotes appear.– Woss
truth, bound to
– Lary
when I place the int in front appears an error message, I should use int?
– Lary
appears the following message Typeerror: 'int' Object is not iterable
– Lary
another problem I noticed is that when I put a number of two houses they appear as two elements of the list and not as one
– Lary