01 / 07
What the double loop was for
You want to find the people who appear on both of two lists. You can already write it.
Loop over group A on the outside, group B on the inside, and add the name whenever the two match. The double loop from chapter 2.
It works, but it takes a moment to read. What the code is trying to do does not show in its shape.
group_a = ["Yui", "Haruto", "Minato"]group_b = ["Haruto", "Sora", "Minato"]both = []for a in group_a: for b in group_b: if a == b: both.append(a)print(both)Result
['Haruto', 'Minato']