Getting started with python

James Stroud jstroud at mbi.ucla.edu
Sun Apr 15 19:42:51 EDT 2007


Gabriel Genellina wrote:
> En Sun, 15 Apr 2007 10:46:54 -0300, Army1987 <please.ask at for.it> escribió:
> 
>> "Paddy" <paddy3118 at googlemail.com> ha scritto nel messaggio
>> news:1176608302.928513.274400 at y5g2000hsa.googlegroups.com...
>>
>>> On a different tack, from:
>>> http://tickletux.wordpress.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/ 
>>>
>>> It seems you need to learn how to write a Fizz-Buzz
>>> program to get a job now-a-days :-)
>>
>> Something less idiotic? I took longer to type a program to do that 
>> than to
>> figure out how to do that.
> 
> We've used it as part of a test a few weeks ago. You'd be surprised on 
> how many guys couldn't write anything remotely sensible.
> 
> --Gabriel Genellina

py> for i in xrange(1,101):
...   if not i % 15:
...     print 'fizzbuzz'
...     continue
...   if not i % 5:
...     print 'buzz'
...     continue
...   if not i % 3:
...     print 'fizz'
...   else:
...     print i
...

I typed this without so much as hitting delete. Didn't time it but I'm 
guessing less than 2 minutes. How much am I worth a year? (Hopefully 
capitalization is not important for this exercise.)

James



More information about the Python-list mailing list