Skip to content
/ fizzbuzz Public template

Code Louisville Python programming exercise

Notifications You must be signed in to change notification settings

jeff-dillon/fizzbuzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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
  2. Clone your forked repo to your machine
  3. Write your code in the fizzbuzz.py file
  4. Optional: test your code on your machine using the automated testing (explained below)
  5. Add, Commit, and Push your code to GitHub
  6. Create a Pull Request to merge your code back to the original repo
  7. 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.
  2. 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.
  3. 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.
  4. Review the output from running the test. This will let you know whether your code produces the expected results.

About

Code Louisville Python programming exercise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages