Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 1.05 KB

DANICA_README_AGAIN.md

File metadata and controls

66 lines (46 loc) · 1.05 KB

Python FizzBuzz

This segment is intended to be used to teach how to use the Python debugger along with Pytest.

Setup

  1. Create a virtual environment
$ python3 -m venv venv
  1. Activate the environment
$ source venv/bin/activate
  1. Install the dependencies
pip install -r requirements.txt

You can now run the tests with the command

$ pytest

FizzBuzz Function

fizzbuzz is a function which returns the string representation of numbers from 1 to n.

But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five output “FizzBuzz”.

Example:

n = 15,

Return:
[
    "1",
    "2",
    "Fizz",
    "4",
    "Buzz",
    "Fizz",
    "7",
    "8",
    "Fizz",
    "Buzz",
    "11",
    "Fizz",
    "13",
    "14",
    "FizzBuzz"
]

Implementation Not working

However this function is not passing all it's tests. Use the debugger to make the program pass the given tests.