Skip to content

Commit

Permalink
Merge pull request exercism#1565 from yawpitch/simplify_raindrops_des…
Browse files Browse the repository at this point in the history
…cription

raindrops: simplify description.md
  • Loading branch information
Katrina Owen authored Aug 6, 2019
2 parents 6823334 + b315f12 commit 477010d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
22 changes: 10 additions & 12 deletions exercises/raindrops/description.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
Convert a number to a string, the contents of which depend on the number's factors.
Your task is to convert a number into a string that contains raindrop sounds corresponding to certain potential factors. A factor is a number that evenly divides into another number, leaving no remainder. The simplest way to test if a one number is a factor of another is to use the [modulo operation](https://en.wikipedia.org/wiki/Modulo_operation).

- If the number has 3 as a factor, output 'Pling'.
- If the number has 5 as a factor, output 'Plang'.
- If the number has 7 as a factor, output 'Plong'.
- If the number does not have 3, 5, or 7 as a factor,
just pass the number's digits straight through.
The rules of `raindrops` are that if a given number:

- has 3 as a factor, add 'Pling' to the result.
- has 5 as a factor, add 'Plang' to the result.
- has 7 as a factor, add 'Plong' to the result.
- _does not_ have any of 3, 5, or 7 as a factor, the result should be the digits of the number.

## Examples

- 28's factors are 1, 2, 4, **7**, 14, 28.
- In raindrop-speak, this would be a simple "Plong".
- 30's factors are 1, 2, **3**, **5**, 6, 10, 15, 30.
- In raindrop-speak, this would be a "PlingPlang".
- 34 has four factors: 1, 2, 17, and 34.
- In raindrop-speak, this would be "34".
- 28 has 7 as a factor, but not 3 or 5, so the result would be "Plong".
- 30 has both 3 and 5 as factors, but not 7, so the result would be "PlingPlang".
- 34 is not factored by 3, 5, or 7, so the result would be "34".
6 changes: 3 additions & 3 deletions exercises/raindrops/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
blurb: "Convert a number to a string, the contents of which depend on the number's factors."
source: "A variation on a famous interview question intended to weed out potential candidates."
source_url: "http://jumpstartlab.com"
blurb: "Convert a number to a string, the content of which depends on the number's factors."
source: "A variation on FizzBuzz, a famous technical interview question that is intended to weed out potential candidates. That question is itself derived from Fizz Buzz, a popular children's game for teaching division."
source_url: "https://en.wikipedia.org/wiki/Fizz_buzz"

0 comments on commit 477010d

Please sign in to comment.