(Learner-here) Lists + Functions = headache

88888 Dihedral dihedral88888 at googlemail.com
Mon May 6 01:39:21 EDT 2013


Bradley Wright於 2013年5月6日星期一UTC+8上午8時59分15秒寫道:
> Hey guys and gals doing this tutorial(codecademy) and needed a bit help from the experienced.
> 
> 
> 
> I'm writing a function that takes a list(one they supply during runtime)
> 
> here's what my function is supposed to do
> 
> 
> 
> 1. for each instance of the string "fizz" make a count
> 
> 2. Finally return that count
> 
> 
> 
> here's my code:
> 
> 
> 
> def fizz_cout(x):
> 
>     count = 0
> 
>     for item in x:
> 
>         while item == "fizz":
> 
>             count += 1
> 

>             return count
> 
This is not indented right in the scope to return 
the total count.




More information about the Python-list mailing list