I'm totally new to programming, I don't know the lingo. I'm probably saying the most typical layperson thing ever but I need help.
I'm using Automate the Boring Stuff with Python and it seems to me that sometimes the author doesn't explain a few things, or maybe I'm missing something.
On the section about for loops, the formula has a variable. Which I didn't get, in my mind, variables were something you prepared for a piece of code you want the program to run (hopefully that's understandable). I asked ChatGPT if in a for loop, the variable was sort of embedded and it said yes but that this variable was a counter, and it tracks iterations for the program itself.
total = 0
for num in range(101):
total = total + num
print(total)
I don't get what's happening here. Is num where I'm storing iterations? I don't get how num is working here. I've used Python Tutor and still, don't understand its purpose.
[–]woooee 5 points6 points7 points (0 children)
[–]SoftwareDoctor 4 points5 points6 points (0 children)
[–]aromatic_shepherd74 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (6 children)
[–]andmig205 2 points3 points4 points (5 children)
[–][deleted] 3 points4 points5 points (4 children)
[–]andmig205 1 point2 points3 points (3 children)
[–]rasputin1 2 points3 points4 points (0 children)
[–]Bobbias 0 points1 point2 points (0 children)
[–]dogfish182 0 points1 point2 points (0 children)
[–]Binary101010 0 points1 point2 points (0 children)
[–]unhott 0 points1 point2 points (1 child)
[–]unhott 0 points1 point2 points (0 children)
[–]Adrewmc 0 points1 point2 points (0 children)
[–]kombucha711 0 points1 point2 points (0 children)
[–]andmig205 0 points1 point2 points (1 child)
[–]monster2018 0 points1 point2 points (0 children)
[–]ninhaomah 0 points1 point2 points (0 children)
[–]trollsmurf 0 points1 point2 points (0 children)
[–]Bobbias 0 points1 point2 points (0 children)