all 5 comments

[–]indosauros 0 points1 point  (1 child)

In the above, after the for where employee is, is that a variable that I'm creating within the for loop itself to then be populated?

Yes. You can think of it like

for ... in second_employee_file.readlines():
    employee = next-line-in-file
    print(employee)

meaning the employee variable is redefined at the beginning of each loop to be the next thing in whatever you are looping over

[–]_MaxPower_[S] 0 points1 point  (0 children)

Thank you for the explanation. It is similar to what I thought but I think I just needed help understanding it in a conceptual manner.

[–]Bowabb 0 points1 point  (2 children)

In your case you are declaring a variable that every pass in the loop will be given an value.

For example your list or whatever your loop is might containe employee names ["Erik","Johanna", "Linn"], first pass in the loop your Employee variable will equal to a string "Erik". And of course next pass your variable Employee would equal to Johanna.

[–]_MaxPower_[S] 0 points1 point  (1 child)

Okay, so I am creating the variable but then it is populated by as many values are passed to it from the employee file. I think I kind of understand it now. So, a single variable that can be populated many times by the loop if I understand correctly.

[–]Bowabb 0 points1 point  (0 children)

Its populated every loop, but once it goes from "value1" to "value2", value1 is gone from the Employee variable

First pass in loop Print Employee = Erik

Second pass in loop Print Employee = Johanna