Day at the supermarket


#1

What is wrong with this?, Please help ,

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


#2

Hello

Did you indent the code correctly?

Example -

def fizz_count(x):
count = 0......................

Look at the example provided by code academy.

Also look at count += 1, your missing something there. Look at total in the example provided.

Hope that helps


#3

Yeah thank you , it worked with count = count + 1,
but what is wrong with count += 1, this worked in java , is it not applicable in Python


#4

Hello

Glad it worked.

I was intrigued by your question, I have not worked with Java that much so I decided to find out, if it could work, I found the following -

As long as the indentation is correct.

Well done to you, I just learnt something new. Now I am going to give you a 'like'.


#5

Oh ..haha Thankz, may be then my indentation was Wrong


#6

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