I am coding to enter values of a vector in the following way:
array=[]
n=3
for i in range(n):
x=int(input("Valor: "))
array.append(x)
However, I searched but I couldn't find another more optimal way to be able to enter values into the array, I come from programming a lot in c++ and I'm learning python, I tried this way:
array=[]
n=3
for i in range(n):
A[i]=int(input("Valor: "))
But it is not valid, is there a more appropriate way to enter values by keyboard to an array?
I recommend you use
List Comprehensions
the following way.