/fizzbuzz

Primary LanguagePython

FizzBuzz

This repository contains a simple implementation of the FizzBuzz program by the user "carnageiron". The FizzBuzz program is a common coding exercise that prints numbers from 1 to a given limit while following certain rules. The readme file provides an overview of the program, its functionality, and instructions for running and testing the code.

Table of Contents

Program Description

FizzBuzz is a classic programming exercise often used as an interview question. The program prints numbers from 1 to a given limit, replacing numbers divisible by 3 with the word "Fizz", numbers divisible by 5 with the word "Buzz", and numbers divisible by both 3 and 5 with the word "FizzBuzz". For example, when the limit is set to 15, the program will produce the following output:

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz

This repository contains a simple implementation of the FizzBuzz program using Python.

Installation

To run the FizzBuzz program locally, follow the steps below:

  1. Clone the repository to your local machine using the following command:
git clone https://github.com/carnageiron/fizzbuzz.git
  1. Navigate to the project directory:
cd fizzbuzz
  1. Ensure you have Python installed. The program is compatible with Python 3.

Usage

To execute the FizzBuzz program, follow these steps:

  1. Navigate to the project directory:
cd fizzbuzz
  1. Run the Python script using the following command:
python fizzbuzz.py
  1. You will be prompted to enter the upper limit for the FizzBuzz sequence. Enter a positive integer and press Enter.

  2. The program will generate the FizzBuzz sequence and print it to the console.

Testing

Unit tests have been included to verify the correctness of the FizzBuzz implementation. To run the tests, follow these steps:

  1. Ensure you are in the project directory.

  2. Run the test script using the following command:

python test_fizzbuzz.py
  1. The test results will be displayed in the console, indicating whether all tests passed or if there were any failures.

Contributing

Contributions to the FizzBuzz program are welcome! If you would like to contribute, please follow these guidelines:

  1. Fork the repository to your GitHub account.

  2. Create a new branch from the main branch to work on your changes.

  3. Make your desired changes or additions.

  4. Commit and push your changes to your forked repository.

  5. Submit a pull request detailing your changes and explaining their purpose.

Please ensure that your contributions align with the goals of the FizzBuzz program and adhere to any coding or documentation standards mentioned in the repository.

License

FizzBuzz is distributed under the MIT License. You can find more details about the license in the LICENSE file.