Hello! I have done the exercise the correct way, but had this originally and wanted to know why the += .pop() situation worked this way: I’m getting an output that is taking each letter of each name and making it into its own item. Why does .pop() in this case remove individual letters and not the entire item?
all_students = [“Alex”, “Briana”, “Cheri”, “Daniele”, “Dora”, “Minerva”, “Alexa”, “Obie”, “Arius”, “Loki”]
students_in_poetry =
index = 0
while index < 6:
students_in_poetry += all_students.pop()
index += 1
print(students_in_poetry)
print (all_students)
result:
[‘L’, ‘o’, ‘k’, ‘i’, ‘A’, ‘r’, ‘i’, ‘u’, ‘s’, ‘O’, ‘b’, ‘i’, ‘e’, ‘A’, ‘l’, ‘e’, ‘x’, ‘a’, ‘M’, ‘i’, ‘n’, ‘e’, ‘r’, ‘v’, ‘a’, ‘D’, ‘o’, ‘r’, ‘a’]
[‘Alex’, ‘Briana’, ‘Cheri’, ‘Daniele’]