Skip to content

Implemented as an example for CodeFellows Python Bootcamp

Notifications You must be signed in to change notification settings

nhuntwalker/fizzbuzz

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FizzBuzz

Build Status

A pair of simple example functions that implement the fizzbuzz game.

fizzbuzz

For any given n, print Fizz if n is divisible by 3, Buzz if n is divisible by 5, and FizzBuzz if n is divisible by both 3 and 5. For all other numbers, print that number.

    >>> from fizzbuzz import fizzbuzz
    >>> for i in range(16):
    ...     print fizzbuzz(i)
    ...
    0
    1
    2
    Fizz
    4
    Buzz
    Fizz
    7
    8
    Fizz
    Buzz
    11
    Fizz
    13
    14
    FizzBuzz

fizzbuzz_extended

Implement the FizzBuzz game, but allow arbitrary extensions. For example, numbers divisible by seven should print as 'Sezz'.

    >>> from fizzbuzz import fizzbuzz_extended
    >>> extras = {7: 'Sezz'}
    >>> for i in range(16):
    ...     print fizzbuzz_extended(i, extras)
    ...
    0
    1
    2
    Fizz
    4
    Buzz
    Fizz
    Sezz
    8
    Fizz
    Buzz
    11
    Fizz
    13
    Sezz
    FizzBuzz

About

Implemented as an example for CodeFellows Python Bootcamp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 80.6%
  • Gherkin 19.4%