Guys...I'm lost


#1

https://www.codecademy.com/courses/python-intermediate-en-rCQKw/2/1?curriculum_id=4f89dab3d788890003000096#

When I run the code, it shows an error message:

"'dict' object is not callable".

For any reason, it works on python shell but doesn't works on codecademy.

This code should count how many times a number appears in a given sequence, regardless the type of data (it can be even "one"or "1").

def count(sequence,item):
    ext={"one":1,
         "two":2,
         "three":3,
         "four":4,
         "five":5,
         "six":6,
         "seven":7,
         "eight":8,
         "nine":9,
         "ten":10}
    found = 0
    if item not in ext:
        var = int(item)
    else:
        var = ext(item)
    for i in sequence:
        if i == var:
            found = found+1
    return found


#2

I think you might be overthinking this just a tad bit. Try using the following template for assistance:

def function(parameter_1, parameter_2):
    variable = 0
    for each in parameter_1:
        if each == parameter_2:
            variable += number
    return variable

#3

You're right, I tried this today and it worked:

def count(sequence,item):
    found = 0
    var = item
    for i in sequence:
        if i == var:
            found = found+1
    return found

Thank you for the help!


#5