0

What I want to do is save variable, repeatedly, but with another number.

I want to save arrays like below.

test_1 = 1
test_2 = 1
test_3 = 1
test_4 = 1
test_5 = 1

This is what I tried to do.

for i in range(1,6):
    test_i = 1

But the result was that the number 1 is saved in variable named as "test_i". It seems like change of i doesn't work at variable.

Newbie0105
  • 119
  • 1
  • 12

1 Answers1

0

What you are doing is reinitializing the variable test_i as 1.

I'm not sure you can do what you wanted to do, maybe you could look into namespaces.

Lee Garcon
  • 182
  • 10