Csv is importing the incorrect values

Screen Link:

My Code:

import csv
file = open('dq_unisex_names.csv')
reader = csv.reader(file)
rows = list(reader)

longest_names = []
for row in rows[1:]:
    if len(row[0]) > 10:

# Testing answer
for i in range(5):

What I expected to happen:
A list named longest_names containing all names with length greater than ten.

What actually happened:


Did I overwrite the list?

What do you think this part of your code is doing?

# Testing answer
for i in range(5):

Have you tried printing just the variable longest_names?

Also, in your screenshot, in the lower-right section, you can view the values for all your variables. Click the triangle to see what longest_names's value is.

Printing longest_names Yields the same results as the error values and the values in the lower-right section are also the same as those in the error.

The code I entered is directly from the solutions for the question (deleted all of my code and pasted all of the code from the solutions), which makes me believe that this issue is something deeper than that of the code.

I’m not sure if I’m following you. Why do you think what you are seeing are “error values”? Don’t all the names in longest_names have a length greater than ten?

The dq_unisex_names.csv tab is only showing some of the values in the CSV file. Try print(rows) if you want to see all the content of the CSV. If you have a Dataquest subscription, you can also download the CSV file to your computer.