Lists and For Loops issue

Screen Link:

I uploaded a screenshot, not sure if there is a specific way of getting a screen link.

My Code:

Paste your code here

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


What I expected to happen:

Open the AppleStore.csv file and store it as list of lists.

  1. Open the file using the open() command. Save the output to a variable named opened_file .
  2. Read in the opened file using the reader() command (we’ve already imported reader() for you from the csv module). Save the output to a variable named read_file .
  3. Transform the read-in file to a list of lists using the list() command. Save the list of lists to a variable named apps_data .
  4. Explore apps_data . You could:
  • Print its length using the len() command
  • Print the first row (the row describing column names)
  • Print the second and the third row (try to use list slicing here)

What actually happened:

TypeErrorTraceback (most recent call last)
in ()
4 apps_data =list(read_file)
----> 6 print(len(apps_data))
7 print(apps_data[0])
8 print(apps_data[1:3])

TypeError: ‘int’ object is not callable
apps_data ()

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

Hi there, totally new to this. I followed the instructions, cross checked my answer with the provided answer, and despite the code being identical, it still returns an error and I can't proceed.

Please help, I'd love some feedback if I'm doing something wrong.

Thank you in advance.

Some observations:

It seems like any time I use print() it gives me an error. If I only needed len() for example, it worked fine. If I were to seek that same output using print() though, it just gives me the error message... no idea what is different.

Without print()

![Screen Shot 2020-04-04 at 1.39.16 AM|690x369](upload://5LSULo8mkUf1yXZrlgtTTEqjNw1.png) 

With print()

![Screen Shot 2020-04-04 at 1.42.30 AM|690x360](upload://zHHV9Fr8NSFcGsvf8V6g5CgFaI0.png)

Hi Giovanni, welcome to the community!

It seems like at some point in your session, print was used as a variable. Try using del print in the code window, run it, and then copy your code back in and rerun it. See the post below for information about this kind of error.


Read it through and worked like a charm, thank you so much @april.g and @Sahil !!

1 Like