do you fail at FizzBuzz? simple prog test

Arnaud Delobelle arnodel at googlemail.com
Mon May 12 04:35:32 EDT 2008


On May 12, 9:30 am, Arnaud Delobelle <arno... at googlemail.com> wrote:
[...]
> # FizzBuzzer in action:
>
> >>> fizzbuzz = FizzBuzzer((3, 'Fizz'), (5, 'Buzz'))
> >>> for val in fizzbuzz[1:21]:
>
> ...     print val
> ...
> 1 21 1
^^^^^^^^
Ignore this, it's debugging output

> 1
> 2
> Fizz
> 4
> Buzz
> Fizz
> 7
> 8
> Fizz
> Buzz
> 11
> Fizz
> 13
> 14
> FizzBuzz
> 16
> 17
> Fizz
> 19
> Buzz>>> abc = FizzBuzzer((2, 'Ah'), (3, 'Bee'), (5, 'Cee'))
> >>> list(abc[25:35])
>
> 25 35 1
^^^^^^^^^
Same

> ['Cee', 'Ah', 'Bee', 'Ah', 29, 'AhBeeCee', 31, 'Ah', 'Bee', 'Ah']

--
Arnaud




More information about the Python-list mailing list