x = extract(n)
for c in x:
if c in a:
a[c] += 1
a[c] = 1
What I expected to happen:
Expected the code to run
What actually happened:
It gave an error and apparently the main root cause is this line " x = extract(n)".
In the solution after creating an empty dictionary, why are we not creating a list with keys, just like we did earlier examples. Why is it that - creating a list is not required and instead immediately after the blank dictionary, the for- in code is referring to the parameter in the function ( i.e. def freq_table(column) , when we are yet to define the argument which will be in the form of list
Running your code caused an error.
genres_ft isn’t defined in your code, but we expected it to be dict type
You are calling extract()inside your freq_table() function, even though it has already been called before -
freq_table function does not need to call the extract() function.
Because that’s what extract() function does for you. You are creating a frequency table based on the list that you get from calling the extract() function. The items in that list will be the keys for your frequency table.
I would recommend going over the instructions carefully once more to better understand what’s going on.
thanks, i think it will take some time to build intuition. Or is that wrong to say in coding !
if a list has already been called earlier - extract () - it need not be called again even though that was the format in simpler examples . That’s something to dwell upon