Re: (Learner-here) Lists + Functions = headache

2013-05-06 Thread Mark Lawrence
On 06/05/2013 02:30, Bradley Wright wrote: Aha! lessons learned - got it! The next lesson is to read the link given in my signature, digest it and take action to avoid masses of superfluous newlines in your responses. TIA. -- If you're using GoogleCrap™ please read this http://wiki.pytho

Re: (Learner-here) Lists + Functions = headache

2013-05-06 Thread Chris Angelico
On Mon, May 6, 2013 at 3:39 PM, 8 Dihedral wrote: > Bradley Wright於 2013年5月6日星期一UTC+8上午8時59分15秒寫道: >> def fizz_cout(x): >> >> count = 0 >> >> for item in x: >> >> while item == "fizz": >> >> count += 1 >> > >> return count >> > This is not indented right

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread 88888 Dihedral
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

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread Steven D'Aprano
On Mon, 06 May 2013 01:31:48 +, Steven D'Aprano wrote: > So your function always returns either 0 (if there are no > "fizz" in the list at all) or 1 (if there is any "fizz"). Correction: (thanks to Terry for pointing this out). It will return None or 1, not 0. How easy it is to fall into th

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread Bradley Wright
On Sunday, May 5, 2013 9:24:44 PM UTC-4, Bradley Wright wrote: > On Sunday, May 5, 2013 9:21:33 PM UTC-4, alex23 wrote: > > > On May 6, 10:59 am, Bradley Wright > > > > > > wrote: > > > > > > > def fizz_cout(x): > > > > > > >     count = 0 > > > > > > >     for item in x: > > > > >

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread Steven D'Aprano
On Sun, 05 May 2013 17:59:15 -0700, Bradley Wright wrote: > 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 ins

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread Terry Jan Reedy
On 5/5/2013 8:59 PM, Bradley Wright wrote: 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 Do they supply an example so you can test

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread Bradley Wright
On Sunday, May 5, 2013 9:21:33 PM UTC-4, alex23 wrote: > On May 6, 10:59 am, Bradley Wright > > wrote: > > > def fizz_cout(x): > > >     count = 0 > > >     for item in x: > > >         while item == "fizz": > > >             count += 1 > > >             return count > > > > > > Please re

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread alex23
On May 6, 10:59 am, Bradley Wright wrote: > def fizz_cout(x): >     count = 0 >     for item in x: >         while item == "fizz": >             count += 1 >             return count > > Please remember that i am a eager beginner, where am i going wrong? There are several problems with your code:

(Learner-here) Lists + Functions = headache

2013-05-05 Thread Bradley Wright
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 he