The code is as follows:
for row in students_list:
first, middle, last, birth = row["first"], row["middle"], row["last"], row["birth"]
print(f"{first} {middle + ' ' if middle else ''}{last}, born {birth}")
Output is as follows:
~/pset7/houses/ $ python roster.py Gryffindor
Lavender Brown, born 1979
Lavender Brown, born 1979
Lavender Brown, born 1979
Colin Creevey, born 1981
Colin Creevey, born 1981
Colin Creevey, born 1981
Seamus Finnigan, born 1979
Seamus Finnigan, born 1979
Seamus Finnigan, born 1979
Hermione Jean Granger, born 1979
Hermione Jean Granger, born 1979
Hermione Jean Granger, born 1979
Neville Longbottom, born 1980
Neville Longbottom, born 1980
Neville Longbottom, born 1980
Parvati Patil, born 1979
Parvati Patil, born 1979
Parvati Patil, born 1979
Harry James Potter, born 1980
Harry James Potter, born 1980
Harry James Potter, born 1980
Dean Thomas, born 1980
Dean Thomas, born 1980
Dean Thomas, born 1980
Romilda Vane, born 1981
Romilda Vane, born 1981
Romilda Vane, born 1981
Ginevra Molly Weasley, born 1981
Ginevra Molly Weasley, born 1981
Ginevra Molly Weasley, born 1981
Ronald Bilius Weasley, born 1980
Ronald Bilius Weasley, born 1980
Ronald Bilius Weasley, born 1980
How am I supposed to fix this? I would appreciate even a clue to what is causing the problem. Thanks.