Screen Link:
My Code: <<<!–opened_file = open(‘AppleStore.csv’)
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
n_user_ratings =
for row in apps_data[1:]:
n_user_ratings.append(int(row[5]))
max_ratings = max(n_user_ratings)
#print(‘The maximum ratings’, n_user_ratings)
min_ratings = min(n_user_ratings)
#print(‘The minimum ratings’, n_user_ratings)
user_ratings_freq = {‘0 - 10000’:0,‘100000 - 100000’: 0, ‘100000 - 5000000’: 0, ‘50000000 - 10000000’: 0, ‘1000000+’: 0}
for row in apps_data[1:]:
user_ratings = (int(row[5]))
if user_ratings <= 10000:
user_ratings_freq['0 - 10000'] += 1
elif 10000 < user_ratings <= 100000:
user_ratings_freq['10000 - 100000'] += 1
elif 100000 < user_ratings <= 500000:
user_ratings_freq['100000 - 500000'] += 1
elif 500000 < user_ratings <= 10000000:
user_ratings_freq['500000 - 1000000'] += 1
elif user_ratings > 10000000:
user_ratings_freq['10000000 +'] += 1
print (user_ratings_freq)Enclose your code in 3 backticks to format properly–>
Replace this line with your code
What I expected to happen:Output the user ratings.
What actually happened: KeyError Traceback (most recent call last)
in
27
28 elif 500000 < user_ratings <= 10000000:
—> 29 user_ratings_freq[‘500000 - 1000000’] += 1
30
31 elif user_ratings > 10000000:
KeyError: ‘500000 - 1000000’
Replace this line with the output/error