Solution doesn't work?

Screen Link:

My Code:

opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)

def extract(column):
    result = []
    for row in apps_data[1:]:
        extract = row[column]
        result.append(extract)
        return result   
    
genres = extract(11)

What I expected to happen:
Extract column number 11.

What actually happened:

genres is shorter than we expected.

Any idea what i did wrong in my solution? I think about any single Step but i can’t find the mistake here.

Thanks.

Hi @Simo

The issue is the indentation of your return statement. In your code the for-loop just runs ones and then result is returned. What you actually want is to return result after the whole loop has been completed.
So you need to move it 4 spaces to the left.

Best
htw

3 Likes

Oh no, now i see the issue.
I was blind :smiley:
Thank you so much for your help! Now i can go ahead with the materials.

-Simo