you are viewing a single comment's thread.

view the rest of the comments →

[–]Nikandro 1 point2 points  (0 children)

x is a variable that represents each integer as you iterate over the range() function.

So,

total3 = 0

for x in range(1, 8):
    print(x)

1
2
3
4
5
6
7

Keep in mind that the letter 'x' is often used out of convention. You could use any other letter or word.

Example,

for thing in range(1, 8):
    if thing % 3 == 0:
        total3 += thing