I will let you in on some of the thought process that we develop as we mature, or gain confidence, in coding for a particular language, in this case, Python.
Let’s take it back to the first weird statement we encountered in programming…
a = a + 1
Once we learn that the expression on the right is being assigned to the variable on the left it all makes sense. But it was weird on that first encounter.
We’ve given a variable a particular state, but then later we alter that state based on its current state. Make sense?
That’s what is happening in the two lines that define the same variable. The first line defines, the second line refines it, using its current values. It’s a morphing from one object form, a list, to another object form, a dictionary and allowing it to keep its name.
One will not get into the mechanics above. There are ranges, by the way, two of them. It is possible to construct those for loops in block syntax, which I would suggest you do to see how they play out. They are nested, so bear that in mind.
Hold off playing with this too much while you get under way. Course material and progressing forward should come first. This will still be here when you come back around. Happy coding!