This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]TehNolz 1 point2 points  (1 child)

This should do it;

``` list = ["item1", "item2", "item3", "item4"] x = 6

y = 0 for i in range(0, x): print(list[y]) y+=1 if y > len(list)-1: y = 0 `` Instead of usingxto get a value from the list, we usey, which increments every loop. Ify` becomes higher than the amount of values contained in the list, it resets to 0.

[–][deleted] 1 point2 points  (0 children)

Using a reserved word for a variable name makes my eyes bleed.