Python Fundamentals Guided Project 1. error division by zero?

categories_android = freq_table(free_english_clean_android, 1)
for category in free_english_clean_android:
    total=0
    len_category=0
    for app in free_english_clean_android:
        category_app=app[1]
        if category_app==category:
            n_installs= app[5]
            n_installs=n_installs.replace('+','')
            n_installs=n_installs.replace(',','')
            total += float(n_installs)
            len_category += 1
    avg_installs=total/len_category
    print(category,':',avg_installs)![48%20PM|690x431](upload://74O9C28Au4dN2o8fXG37SGWLXGG.png)

Hi Sherif, welcome to the community!

I think instead of for category in free_english_clean_android: you should have for category in categories_android: so that you’re using the dictionary you created. I tried it and I’m not getting a divide by zero error anymore.

2 Likes