4 list & functions explanation please


#1

def fizz_count(x):
count = 0
for n in x:
if n == 'fizz':
count = count + 1
return count

it printed none...


#2

None is the value returned from a function when there is no return value, or no return statement. If your return statement is nested inside the if statement, and the is no fizz in the list, there will be no return statement seen. Without formatting of your code sample we cannot know for sure what the problem is.


#3

so thats how it is, well thanks now i think i have an idea now.


#4

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