Apr-12-2018, 01:23 AM
Ok I built a very basic caesar wheel...(w/out modules/classes). There was more trial/error than I care to admit
. But, I came across something I couldn't figure out. Here is the relevant snippet.
very puzzling to me... thx in advance...

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
base_wheel = [ 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' , 'j' , 'k' , 'l' , 'm' , 'n' , 'o' , 'p' , 'q' , 'r' , 's' , 't' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z' ] new_wheel1 = [] new_wheel2 = [] spinner1 = random.randint( 0 , 25 ) spinner2 = spinner1 for b in base_wheel: new_wheel1.append(base_wheel[spinner1]) spinner1 - = 1 #no problem with decrementing for b in base_wheel: new_wheel2.append(base_wheel[spinner2]) #why does += 1 (below) go over range? I am looping elements of base_wheel #loop is finite so spinner2 must also terminate spinner2 + = 1 |