# Infinite Loop Exercise Output

I must be missing something, but the output of the following exercise doesnt append “list b” to “list a”:

students_period_A = [“Alex”, “Briana”, “Cheri”, “Daniele”]
students_period_B = [“Dora”, “Minerva”, “Alexa”, “Obie”]

for student in students_period_A:
#students_period_A.append(student)
students_period_B.append(student)
print(student)

The output does not include list B and the names in the list, just list A:

Alex,
Briana,
Cheri,
Daniele

why do you think the names in list b should be included in the output?

Your loop seems to print `student` in `students_period_A`.

If you want to print `students_period_A` after the for loop has finished, print that outside the loop.

Assuming that your code is indented like this (always use the </> to preserve indentation):

``````students_period_A = [“Alex”, “Briana”, “Cheri”, “Daniele”]
students_period_B = [“Dora”, “Minerva”, “Alexa”, “Obie”]

for student in students_period_A:
#students_period_A.append(student)
students_period_B.append(student)
print(student)
``````

… your printout is exactly as expected.

• (First time around): `for student in students_period_A:` looks in the list, students_period_A, and grabs the first item, the string “Alex”.

• It assigns that string to the iteration variable student

• (next line): the value (“Alex”) assigned to the variable student is appended to the list, students_period_B

• (next line): the value (“Alex”) assigned to the variable student is passed to the print() function, which prints that string to the screen : Alex

• Now back to for, repeat the above with "Briana"

Did you mean to print the final list, students_period_B? If so, you might want to alter the indentation of the print() statement.