In a for in C, we define "start, end and increment step. " I know Python is not like this. I saw it called foreach . I wish the end of my for to be defined by the user. And that, at each iteration until the end of for, a value was requested from the user and saved in a vector.
I tried:
num_tracos = raw_input()
tracos_treino = np.arange(100)
for i in num_tracos:
print "Digite o traco", i+1, " para o treinamento"
tracos_treino[i] = raw_input()
I also tried a while , but it did not work because I never ends (it actually gives error when it reaches entry 101, because it no longer fits into the vector, but if it were not for that, it would be infinite):
num_tracos = raw_input()
tracos_treino = np.arange(100)
i=0
while i < num_tracos :
print "Digite o traco", i+1, " para o treinamento"
tracos_treino[i] = raw_input()
i = i+1
I've always heard that for that a while , unless you go iterate (ie never) . I read this in "Learn Python The Hard Way."
Anyway, neither is working the way I would.