generated from CLCK-Data-Aug2023/fizzbuzz-723ab4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
2 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,3 @@ | ||
[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-718a45dd9cf7e7f842a935f5ebbe5719a5e09af4491e668f4dbf3b35d5cca122.svg)](https://classroom.github.com/online_ide?assignment_repo_id=12590591&assignment_repo_type=AssignmentRepo) | ||
# FizBuzz | ||
Code Louisville Python programming exercise | ||
|
||
## Overview | ||
|
||
> Fizz buzz (often spelled FizzBuzz in this context) has been used as an interview screening device for computer programmers. Writing a program to output the first 100 FizzBuzz numbers is a relatively trivial problem requiring little more than a loop and conditional statements. However, its value in coding interviews is to analyze fundamental coding habits that may be indicative of overall coding ingenuity. | ||
From [FizzBuzz](https://en.wikipedia.org/wiki/Fizz_buzz) on wikipedia.org. | ||
|
||
In this exercise we will implement the classic programming challenge FizzBuzz. This is the Week 2 Bonus Exercise from the openSAP Learn Python course.If you have already solved it as part of the Learn Python course you can re-use your code here. | ||
|
||
Write a Python program that prints the numbers from 1 to 100. If the number is dividable by 3 print Fizz, if the number is dividable by 5 print Buzz instead of the number. If the number is dividable by 3 and 5 print FizzBuzz instead of the number. | ||
|
||
Below is the output of the program for the first 15 numbers: | ||
|
||
``` | ||
1 | ||
2 | ||
Fizz | ||
4 | ||
Buzz | ||
Fizz | ||
7 | ||
8 | ||
Fizz | ||
Buzz | ||
11 | ||
Fizz | ||
13 | ||
14 | ||
FizzBuzz | ||
``` | ||
|
||
|
||
## Instructions | ||
|
||
1. **Fork this repo** to your account | ||
1. **Clone your forked repo** to your machine | ||
1. **Write your code** in the fizzbuzz.py file | ||
1. Optional: test your code on your machine using the automated testing (explained below) | ||
1. **Add, Commit, and Push** your code to GitHub | ||
1. **Create a Pull Request** to merge your code back to the original repo | ||
1. Wait for feedback on the Pull Request from a mentor | ||
|
||
### Optional: Automated Code Testing | ||
|
||
This repo contains a small testing program that is automatically run by GitHub | ||
to validate your code. This testing program is contained in the test_fizz.py | ||
file. You don't have to do anything with this file to complete the exercise, | ||
but you can follow these steps if you would like to run the tests on your | ||
machine. | ||
|
||
1. Open GitBash in Windows or the Terminal in Mac and navigate to the project folder. | ||
1. Install the `pytest` packages. This program uses a python package called pytest. We'll be covering packages later in the course, so for now you can | ||
just run the following command without getting into the details of how it | ||
works: `pip install pytest`. | ||
1. Run the tests. We won't be covering testing with python in this course. Use | ||
the following command to run the tests: `pytest tests.py`. You can read more about it [here](https://realpython.com/python-testing/). | ||
1. Review the output from running the test. This will let you know whether your | ||
code produces the expected results. | ||
# FizzBuzz | ||
|
||
This is my take on the classic FizzBuzz challenge. |