diff --git a/README.md b/README.md index dee6e71..0cb65b3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,28 @@ +# README FizzBuzzPython + My try at the fizzbuzz code kata challenge. The problem definition: https://leetcode.com/problems/fizz-buzz/description/ -Evan Young -Winnipeg, Manitoba, Canada +## Setup: + +If you are just getting into python set your virtual environment: + +Note: This is powershell on Windows not bash. + +```powershell +# Create a virtual environment +PS > python -m venv .venv + +# Activate the virtual environment +PS > .venv\scripts\activate + +# Install the dependencies +(.venv) PS > pip install -r requirements.txt + +# Run the app +(.venv) PS > python app.py + +# Run the tests +(.venv) PS > pytest +``` \ No newline at end of file diff --git a/app.py b/app.py index d103075..abb39f9 100644 --- a/app.py +++ b/app.py @@ -18,7 +18,8 @@ def main(): if __name__ == '__main__': result = main() - line_no = 0 - for value in result: - line_no += 1 - print(f'{line_no:02d} {value}') \ No newline at end of file + for i in range(len(result)): + print(f'{i:02d} {result[i]}') + + # it's more complex but you could use a comprehension + # print('\n'.join(f'{i:02d} {result[i]}' for i in range(len(result))) \ No newline at end of file