I have a different method?

Screen Link:
https://app.dataquest.io/m/350/guided-project%3A-profitable-app-profiles-for-the-app-store-and-google-play-markets/10/most-common-apps-by-genre-part-two

My Code:

def freq_table(dataset, index):
    frequency_table = {}
    for row in dataset:
        if row[index] in frequency_table:
            frequency_table[row[index]] += 1
        else: 
            frequency_table[row[index]] = 1
    for key in frequency_table:
        frequency_table[key] /= len(dataset)
    for key in frequency_table:
        frequency_table[key] *= 100
    return frequency_table

freq_table(apple_data_final, 11)```

What I expected to happen:


What actually happened:  So this is what i came up with for the function freq_table(). Its alot different to whats in the solution. I cant see anything wrong with mine except i have one extra for loop. Just curious if this solution is valid. 

So this is what i came up with for the function freq_table(). Its alot different to whats in the solution. I cant see anything wrong with mine except i have one extra for loop. Just curious if this solution is valid.


<!--Enter other details below: -->

@aidanclifford

Hey, there are many solutions possible, it’s okay to come up with a different one. But for choosing between two solutions, consider these key points:

Simplicity/Readability

The complexity of code (time/space)

So if you can solve a problem without any extra for loop needed then that’s recommended because it reduces time complexity.

It’s fine for smaller datasets but for bigger datasets, this should be considered.