Python - How to print multiple variables in loop?

-1

I am collecting 7 different values through a while . Whenever while is rotated, a value is assigned to variable valor and is printado , but I would like to save each valor to a variable for later use.

For example, the first print, var1 = valor , the second time, var2 = valor , the third time, var3 = valor ...

    
asked by anonymous 13.04.2017 / 15:38

1 answer

1

If someone is in the same situation:

As Anderson Carlos Woss explained above, create a lista and use lista.append(objeto) to put the values in the list.

If you want to pass to a variable, set the variavel = lista[posição] .

If your values are of type string , and you want to transform to inteiro , when setting variavel , do: variavel = int(lista[posição]) .

Thanks to all who helped!

    
13.04.2017 / 16:21