Function


#1

def count(sequence,item):
_ c = 0_
_ for i in sequence:_
_ if i == item:_
_ c += 1_
return c
print "%s apears %s times in %s " % item, total,sequence

can you help me out I struggle with printing after my function


Please find the problem in my code
#2

a function only execute when called, you never call the function, so not much will happen

also, return is the last thing a function does, so a return keyword will end the function. Any code after it won’t be reached


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.