Errors in the practice code sample data

In the practice questions the for python fundamentals there some errors in the same data.

Screen Link: https://app.dataquest.io/m/1012/python-fundamentals-practice-problems/7/selecting-rows-on-a-csv

Your Code: N/A

What I expected to happen:
users.csv only has two columns of data; name and email, not multiple like the sample input outputs list at the top of code section.

What actually happened:
Can write the correct function but sample tests don’t give expected answers.

submission still works and if function is correct gets pass.
Couple the earlier questions have the same issue, contents of the sample file are incorrect.
Other details:

1 Like

Agreed; I’ve noticed the same thing in several of these practice exercises. I have executed the sample test cases with “incorrect” results, only to have the actual submission be graded correctly. This ends up wasting time trying to debug after the sample test cases fail. At that point, there’s no reason to even include them at all.

1 Like

I noticed the same thing today. For the code:

# provided inputs
csv_filename = "users.csv"
col_name = "name" 
value = "Annette Barnes"
# answer to this input:
"""
[['1', '[email protected]', 'Annette Barnes', '601 Wright Crescent Apt. 576 Wolfburgh UT 95796'], 
['4', '[email protected]', 'Annette Barnes', '95373 Simpson Fall Jenniferton ID 73397']]
"""

from csv import reader

def select(csv_filename, col_name, value):
    opened_file = open(csv_filename)
    read_file = reader(opened_file)
    database = list(read_file)
    database = database[1:]
    
    index = find_col_index(csv_filename, col_name)
    if index == -1:
        return None
    
    rows_selected = []
    for each in database:
        if each[index] == value:
            rows_selected.append(each)
    return rows_selected

print(select(csv_filename, col_name, value))

The output of this code is [empty] which is not per the expected output given above. Despite this the code is graded as correct.

I too ran onto this with my code. Then I plugged in DQ answer code which still gives an empty list - https://app.dataquest.io/m/1012/python-fundamentals-practice-problems/7/selecting-rows-on-a-csv

I think the users.csv may have changed.

Submitting it works though…atleast we can proceed