hi,this is my code and for me it is ok and works fine (exercie "compter")
def compter(sequence, element):
resultat = 0
for i in sequence:
if i == element:
resultat = resultat +1
And when i run it, an error is raised : 'int' object is not callable
I don't understand what's wrong .. any help ?
That code won't produce such an error message on its own, so you'll have to consider how the function was called. Find a way to reproduce it. Per haps there is some input specification that you can use to create some test cases to test your function with.
Or maybe it has nothing to do with that function? Find out how to reproduce the crash!
Your function compter() was defined to be calledlike
thanks for your replies..This code a my answer to exercice 11 and based on my tests, it provides the expected anwsers however when i submti it, the error is displayed.
Why is codecademy raising errors for this very basic code ?
@raoul2000could you provide the link to the lesson ....
You're right, it shouldn't. There's a bug in the submission test and they're not fixing bugs in that track I can't even report it.
I can make it crash though. There's this uh, brilliant, design choice of passing crashing exercises, so if I can make it crash I can make it "pass" as well.
Adding this at the top or bottom should do the trick:
Exception = NameError = 1; 1/0
it passes now ... uh I mean it crashes ... well anyway, thanks ionatan