Skip to main content

Powerful Fizz Buzz Engine

Project description

FizzBuzz2

A powerful fizz buzz engine.

Overview

Can't you implement Fizz Buzz? No problem! This module solves everything.

Installation

$ pip install fizzbuzz2

Usage

>>> from fizzbuzz import FizzBuzz
>>> print(FizzBuzz())
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, ..., 97, 98, Fizz, Buzz

API

Preparation

>>> from fizzbuzz import FizzBuzz

Configuration Parameters

>>> FizzBuzz.fizz
'Fizz'
>>> FizzBuzz.buzz
'Buzz'
>>> FizzBuzz.fizzbuzz
'Fizz Buzz'
>>> FizzBuzz.delimiter
', '

Judgement Method

>>> FizzBuzz.judge(6)
'Fizz'
>>> FizzBuzz.judge(20)
'Buzz'
>>> FizzBuzz.judge(30)
'Fizz Buzz'
>>> FizzBuzz.judge(31)
'31'

Creating a FizzBuzz Generator

>>> gen = FizzBuzz.generate(start=1, end=100)
>>> print(list(gen))
['1', '2', 'Fizz', '4', 'Buzz', 'Fizz', '7', '8', 'Fizz', 'Buzz', '11', ..., '98', 'Fizz', 'Buzz']

Creating a FizzBuzz Instance

>>> fb = FizzBuzz(start=1, end=100))
>>> print(fb)
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, ..., 97, 98, Fizz, Buzz

Example

>>> FizzBuzz.fizz = 'fizz'
>>> FizzBuzz.buzz = 'buzz'
>>> FizzBuzz.fizzbuzz = 'fizzbuzz'
>>> FizzBuzz.delimiter = '\n'
>>> print(FizzBuzz(start=9, end=15))
fizz
buzz
11
fizz
13
14
fizzbuzz

CLI

Arguments

$ fizzbuzz -h
usage: fizzbuzz [-h] [-s start] [-e end] [-f fizz] [-b buzz] [-z fizzbuzz] [-d delimiter]

a powerful fizz buzz engine.

options:
  -h, --help    show this help message and exit
  -s start      start with this number. (default: 1)
  -e end        end with this number. (default: 100)
  -f fizz       replace "Fizz" string. (default: Fizz)
  -b buzz       replace "Buzz" string. (default: Buzz)
  -z fizzbuzz   replace "Fizz Buzz" string. (default: Fizz Buzz)
  -d delimiter  replace the word delimiter. (default: , )

Example 1

$ fizzbuzz
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, ..., 97, 98, Fizz, Buzz

Example 2

$ fizzbuzz -s 9 -e 15 -f fizz -b buzz -z fizzbuzz -d '\n'
fizz
buzz
11
fizz
13
14
fizzbuzz

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

fizzbuzz2-2.1.16-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file fizzbuzz2-2.1.16-py3-none-any.whl.

File metadata

  • Download URL: fizzbuzz2-2.1.16-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for fizzbuzz2-2.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 fbd475f2a02dde375832bd63ee816368de8293d07934f6da2bfeed6979102302
MD5 89d5b9a3b5d516fe346cad5f37ec6492
BLAKE2b-256 06e8c41c02d041d2f83c48a8e7d0c37dd4671e79a05792b879c42636753594bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page