Index's, For loops, difference between i and j for loops

Hi everyone! I was playing some Tundra Tower(The topic) and I couldn’t get the 2 guards to move to 2 different locations. So I tried(and failed about 10 times(Still can’t do it, if I’m losing hair or smth I’ll ask(I think I can figure it out(I hope)))). Then I realized that I didn’t quite get the index and for loop connection. And umm why is j and i
different things if they do the same?(Well I think they do the same?)

What i mean

i loops

for i in range
bananas = []
bananas[1] = 3.141
bananas[2] = 3.1415
banana = bananas[i]
hero.command(friend, 'say', banana)

J loops

for j in range
bananas = []
bananas[1] = 3.141
bananas[2] = 3.1415
banana = bananas[j]
hero.command(friend, 'say', banana)

They are the same thing. You can name that variable whatever you want, as long as you are then using the correct one in the code afterwards. It literally doesn’t matter.

3 Likes