Count is not working


#1

def count(sequence,item):
c=0
for x in sequence:
if x==item:
c+=1
return c
it pops an error;
Your function fails on count([1],7). It returns None when it should return 0.
can some body please help me soon


#2

if you edit/update your question, leave a reply so i get a notification. please use the following instructions so we can see your indention (which is crucial in python):

select your code and press ctrl + k (or cmd + k if you use a mac)

if this instructions are unclear, you can also insert 3 backticks before and after your code, like so:

```
<p>visible</p>
```

the backtick is located above the tab key on your keyboard

Your code is fine if indented correctly, so i guess you have a indent problem


#3


i got it thankyou very much


#4

Check the location of your return. You are returning inside the if statement so it only returns if the statement is true.


#5

your return is not indented correctly. it now returns after one loop statement. Return should be at the same line as the for loop


#6

that where 1 edit, and 2 reply's within 3 seconds, good you resolved it!