for statement does not work as intended
so the code is intended to increase the value of count every time it meet
the requirement of the if statement and in the end it gives the count of
how many times one particular item has appeared in the list, here is the
code
x = ["fizz", "fizz", "fizz"]
def fizz_count(x):
count = 0
for fizz in x:
return count+1
now i will only gets me 1 ,for i do aware that the for loop stopped at the
very first "fizz" how do i get it going ?(i tried print it return me three
one, now that is a start cause if i am able to tell python to check how
many one there is i will get the frequency of which the string "fizz" had
appeared :)
thank you for anyone who take a look at this
No comments:
Post a Comment