Can someone please check why my code isn't working thanks

Screen Link:
https://app.dataquest.io/c/112/m/314/dictionaries-and-frequency-tables/13/filtering-for-the-intervals

My Code:

rating_counts = {'0-50,000': 0, '50,000 - 500,000': 0, '500,000 - 1,000,000': 0, '1,000,000 - 2,000,000': 0, '2,000,000+': 0}

for row in apps_data[1:]:
    ratings = int(row[5])
    
    if ratings <= 50000:
        rating_counts['0-50,000'] += 1
    
    elif 50000 < ratings <= 5000000:
        rating_counts['50,000 - 500,000'] += 1
    
    elif 500000 < ratings <= 1000000:
        rating_counts['500,000 - 1,000,000'] += 1
    
    elif 1000000 < ratings <= 2000000:
        rating_counts['1,000,000 - 2,000,000'] += 1
    
    elif ratings > 2000000:
        rating_counts['2,000,000+'] += 1
        
print(rating_counts)                       
    

What I expected to happen:

What actually happened:

The last three aren’t counting

Replace this line with the output/error


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

Extra 0 on the high limit on the second comparison.

1 Like

Absolute legend!! Eagle eyed