11/15 Count (practice makes perfect)


#1

def count(sequence,item):
lst = []
for x in sequence:
if x == item:
lst.append(x)
return len(lst.append(x))

what is wrong in my code? i have done proper indentation though it is not visible here.


#2

Here is some code for to look at, as it says in the instructions you want the count of how many times an item appears in a sequence.

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

    return zcount