How can I write a loop that will start C_x at zero and increase them by 200

Viewed 33
if(core_count % 2) == 0:
   txt.write("\n")
   C_x = C_x + 200
   T_x = T_x + 200

this is what I have so far and I want a for-loop that starts c_x at zero and then adds 200 each iteraration

1 Answers

Using a for loop:

max_val = 2000
for C_x in range(0, max_val + 1, 200):
    print(C_x)

Using a while loop:

max_val = 2000
C_x = 0
while C_x <= max_val:
    print(C_x)
    C_x += 200

Output:

0
200
400
600
800
1000
1200
1400
1600
1800
2000
Related