Stuck in final exercise

Screen Link:

https://app.dataquest.io/m/314/dictionaries-and-frequency-tables/13/filtering-for-the-intervals
My Code:

opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
■■■■=[]
for i in apps_data[1:]:
    ■■■■.append(int(i[5]))
print(min(■■■■))   
print(max(■■■■))  
frequency={'0-1000':0,'1000-10000':0,'10000-100000':0,'100000-1000000':0,'1000000-10000000':0}
for i in apps_data[1:0]:
    size=int(i[5])
    if (size >0) and (size<=1000):
        frequency['0-1000']+=1
    elif (size>1000) and (size<=10000):
        frequency['1000-10000']+=1
    elif (size>10000) and (size<=100000):
        frequency['10000-100000']+=1
    elif (size>100000) and (size<=1000000):
        frequency['100000-1000000']+=1
    elif size>1000000:
        frequency['1000000-10000000']+=1
        
print(frequency)

What I expected to happen:
Well, I expected the keys of the dictionary to have some values

What actually happened:

{'10000-100000': 0, '1000-10000': 0, '0-1000': 0, '100000-1000000': 0, '1000000-10000000': 0}

What is the problem here?

Hey @jhnafrin06,

Your code is 99.999% correct!

When declaring the apps_data:

slice [1:0] will not work as index=0 is smaller than the beginning. apps_data[1:0] returns an empty list.

Instead, go from 1st to last with:

  • [1:] go from index=1 and on, and on, including the last value.
2 Likes

Thanks @kakoori. It was a typo which I didn’t notice.Worked well after seeing your response .

1 Like