I am stuck in the exercise of module Functions: Fundamentals in section Reusability and Multiple Parameters

Hi, can anyone help me to understand what i must do on this execise?, i don’t understand why data_set should be the first variable and why i can’t use add() if is part of the learn section, this is the URL of the lesson

And this is my code
\\ opened_file = open(‘AppleStore.csv’)
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)

INITIAL FUNCTION

def freq_table(index, ratings_ft):
frequency_table = {}
ratings_ft= apps_data

for row in ratings_ft[1:]:
    value = row[index]
    if value in frequency_table:
        frequency_table[value] += 1
    else:
        frequency_table[value] = 1
        
return frequency_table

add(index=7, ratings_ft=apps_data)\\

In case that i can use add(), do i need to do something before using it?, because i get this error:


NameError Traceback (most recent call last)
in
18 return frequency_table
19
—> 20 add(index=7, ratings_ft=apps_data)

NameError: name ‘add’ is not defined

Yes, you need to first create such a function just like you are creating/defining the freq_table function. You can’t call a function if it doesn’t exist. That’s why you get the error that add is not defined.

Unless specified, any code in the content is not automatically included for you in the interactive environment. You will have to define the add() function yourself in your code if you wish to use it.