Blue Week Special Offer | Brighten your week!

N_apps_less_9 is a list, but we expected it to be a int

Screen Link: Learn data science with Python and R projects

My Code:
opened_file = open(‘AppleStore.csv’)
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)

n_apps_more_9 =
n_apps_less_9 =

for row in apps_data[1:]:
price = float(row[4])
rating = float(row[7])

if price > 9:

avg_rating = sum(n_apps_more_9) / len(n_apps_more_9)

if price <= 9:


What I expected to happen:
nice work

What actually happened:

  • n_apps_less_9 is a list, but we expected it to be a int.
  • n_apps_more_9 is a list, but we expected it to be a int.

anything wrong if i name n_apps_less_9/ n_apps_more_9 as a list?

Yes, the instructions clarify what’s required -

Find out how many apps have a price greater than $9 and assign the result to a variable named n_apps_more_9

You only need to calculate a single number based on the above. So, n_apps_more_9 or n_apps_less_9 can not be a list. They need to store an integer, not a list.

You’re almost there!

This result is an int. Whereas n_apps_less_9 is a list. Perhaps consider renaming your variables to better match what data they contain?

This operation is saying to divide each element of one list by each element of another list (note: the lists will need to be the same length for this to work) but is this really what we want here?

Thank you both of you. It really remind me the questions requirement and the list needs to be the same length if I want to calculate the average. Really helpful!