Hello. I am working through the free introductory course of Python for Data Analyst Track.
On Assignment 11 “Alternative Ways to Compute an Average”, I ran into an error that is above the competence of someone taking this course. Is seems that it is a syntax error from the developer side.
Nice job understanding that you didn’t do anything wrong. In fact you did, but it’s perfectly natural that you can’t figure it out, partly because of the way the experience at Dataquest is set up (e.g.: code from previous screens isn’t available on this screen for you to see).
By clicking on the magnifying class on top I was able to query questions containing the sequence of words Object not callable. Here are the results. I suggest you look through the first few.
Thanks for indicating that the problem might be in my previous erroneous code.
I was able to fix the code and move on with the assignment using another solution instead of the one you mentioned( or perhaps is the same). For example, in my previous assignment, 10, instead of using len() function to calculate the average, I used the actual number of lines given in the assignment, 7 197.
By converting the actual number to len () function, I was able to pass assignment 11th.
Did the let() function on assignment 10 changed the variable “apps_data” on assignment 11?
I just can’t see the connection between TypeError : ‘list’ object is not callable with the correction I did on the previous page.
Could you please elaborate on that?
Hi, Valentina. I’m glad that you were able to move on.
I’m having a little trouble understanding what you did.
This shouldn’t make any difference.
I don’t understand what this means. Can you explain in a different way? Or perhaps just share your code for both screens (10 and 11).
As I mentioned above, I’m not sure what you did on the previous screens, but you must have assigned something (for example a number) to list, which made it so that list stopped being a function that converts “things” to lists and started being a number.
This makes it so that when you want to use list as a function, like in your code above, it will fail because it’s now a number. Here’s a simplified reproduction of this problem:
>>> val = "Valentina"
['V', 'a', 'l', 'e', 'n', 't', 'i', 'n', 'a']
>>> list = 1337
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
The only explanation I have is that by going back to the previous page (10), I refreshed the page and it just fixed itself.
This came to me as I navigated through the next assignments and have faced the exact same errors. But I was able to fix them by refreshing the previous pages, without doing any other changes to the code.
So I think this might be a future solution to this problem.
Hey @valentina.suveico! While Bruno is helping you, it might be helpful to actually just copy/paste the code you’ve taken a screenshot of here so it’s easier for Bruno to copy/paste into his own machine instead of having to type it in!
Here’s a quick gif on how to format your code as well:
I ran into the same problem as Valentina.
I used list as a loop variable in one of the assignments and hence the list() was overwritten.
Can you please let me know how to reset the env so that list() works as normal?
I can see I’m running into the issue that a lot of other people seem to have come up against. I’m new to Python and the community, so not exactly sure what I may be missing. I tried opening the console and using del element (as my subsitute for del list) but I get this error in my code: