I am unable to add a list to another list using a infinite loop (for loop). Here is the problem:
Suppose we have two lists of students,
students_period_A
andstudents_period_B
. We want to combine all students intostudents_period_B
. Write a for loop that goes through eachstudent
instudents_period_A
and adds it to the end ofstudents_period_B
.
Here is my code:
students_period_A = ["Alex", "Briana", "Cheri", "Daniele"]
students_period_B = ["Dora", "Minerva", "Alexa", "Obie"]
for students_period_B in students_period_A:
students_period_A.append(students_period_B)
How would does it know when this list ends?
This section is talking about infinite loops which is why I think I need to use it: