So far, I think I'm doing it right however it doesn't seem to generate the results I wanted.
def occurrence(e,List):
for item in List:
s = 0
if item == e:
s += 1
return s
Basically I want my function to count how many times e occurs in List. So basically I can do something like:
">>> occurrence(1,[1,2,3,4,5,1,1])
"3
">>>
However it seems like its not looping, and I'm assuming the loop stops after the first time "item" is "e".
So when I run the function I get
">>> occurrence(1,[1,2,3,4,5,1,1])
"1
">>>
The biggest thing here I simplicity, I'm looking to get desired results simply with if, while, for, etc loops.