Giter VIP home page Giter VIP logo

fizzbuzz's Introduction

Kata - Coding Dojo

Objectives

The focus is to practice writing the best code we can possibly write and challenge ourselves. It is important to mention that the goal is not to finish the exercise as soon as posible, but to learn during the process via the discussion with our partner.

Requirements

Each developer must come with their favourite IDE ready to start practicing TDD, ideally with an empty class or function and its associated test prepared to be launched.

Rules

  • Developers should work in pairs.
  • As a rule, Test-Driven Development is mandatory. If you are unaware of this procedure, please try to pair with someone who does.
  • We will run a small retrospective at the end of the session where we will discuss what difficulties we found, what we have done and what we have learnt.
  • Developers would thank their pairs when the session is over.

What you should NOT expect from this dojo session

  • It's neither a master class nor a workshop, but you will learn new approaches to face problems from different perspectives.
  • It's not a place to learn new languages. At least, one of the pair should be comfortable with the chosen programming language.
  • It's not a place to learn how to set up an environment.

How to start

  1. Find a pair.
  2. Decide which programming language you are going to use and in which laptop you will code.
  3. Read carefully the problem described below and if you have any doubt, please refer to the facilitator.

Fizz Buzz

Before you start:

  • Try not to read ahead.
  • Do one task at a time. The trick is to learn to work incrementally.
  • Make sure you only test for correct inputs. there is no need to test for invalid inputs for this kata

Fizz Buzz

Imagine the scene. You are eleven years old, and in the five minutes before the end of the lesson, your Maths teacher decides he should make his class more "fun" by introducing a "game". He explains that he is going to point at each pupil in turn and ask them to say the next number in sequence, starting from one. The "fun" part is that if the number is divisible by three, you instead say "Fizz" and if it is divisible by five you say "Buzz". So now your maths teacher is pointing at all of your classmates in turn, and they happily shout "one!", "two!", "Fizz!", "four!", "Buzz!"... until he very deliberately points at you, fixing you with a steely gaze... time stands still, your mouth dries up, your palms become sweatier and sweatier until you finally manage to croak "Fizz!". Doom is avoided, and the pointing finger moves on.

So of course in order to avoid embarrassment in front of your whole class, you have to get the full list printed out so you know what to say. Your class has about 33 pupils and he might go round three times before the bell rings for breaktime. Next maths lesson is on Thursday. Get coding!

Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".


stop here if you are a beginner. Continue if you can finish the steps so far in less than 30 minutes.


New requirements
  • A number is fizz if it is divisible by 3 or if it has a 3 in it
  • A number is buzz if it is divisible by 5 or if it has a 5 in it

Summary

Return “fizz”, “buzz” or “fizzbuzz”.

For a given natural number greater zero return

  • “fizz” if the number is dividable by 3
  • “buzz” if the number is dividable by 5
  • “fizzbuzz” if the number is dividable by 15
Test cases
Input Result
1 1
2 2
3 fizz
4 4
5 buzz
6 fizz
10 buzz
15 fizzbuzz

Web: http://content.codersdojo.org/code-kata-catalogue/fizz-buzz/

fizzbuzz's People

Watchers

 avatar James Cloos avatar

Forkers

optionalg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.