README.md (2257B)
1 # Raindrops 2 3 Convert a number to a string, the contents of which depend on the number's factors. 4 5 - If the number has 3 as a factor, output 'Pling'. 6 - If the number has 5 as a factor, output 'Plang'. 7 - If the number has 7 as a factor, output 'Plong'. 8 - If the number does not have 3, 5, or 7 as a factor, 9 just pass the number's digits straight through. 10 11 ## Examples 12 13 - 28's factors are 1, 2, 4, **7**, 14, 28. 14 - In raindrop-speak, this would be a simple "Plong". 15 - 30's factors are 1, 2, **3**, **5**, 6, 10, 15, 30. 16 - In raindrop-speak, this would be a "PlingPlang". 17 - 34 has four factors: 1, 2, 17, and 34. 18 - In raindrop-speak, this would be "34". 19 20 21 Run the tests with: 22 23 ```bash 24 bats raindrops_test.sh 25 ``` 26 27 After the first test(s) pass, continue by commenting out or removing the 28 `[[ $BATS_RUN_SKIPPED == true ]] || skip` 29 annotations prepending other tests. 30 31 To run all tests, including the ones with `skip` annotations, run: 32 33 ```bash 34 BATS_RUN_SKIPPED=true bats raindrops_test.sh 35 ``` 36 37 ## Source 38 39 A variation on a famous interview question intended to weed out potential candidates. [http://jumpstartlab.com](http://jumpstartlab.com) 40 41 42 ## External utilities 43 `Bash` is a language to write "scripts" -- programs that can call 44 external tools, such as 45 [`sed`](https://www.gnu.org/software/sed/), 46 [`awk`](https://www.gnu.org/software/gawk/), 47 [`date`](https://www.gnu.org/software/coreutils/manual/html_node/date-invocation.html) 48 and even programs written in other programming languages, 49 like [`Python`](https://www.python.org/). 50 This track does not restrict the usage of these utilities, and as long 51 as your solution is portable between systems and does not require 52 installation of third party applications, feel free to use them to solve 53 the exercise. 54 55 For an extra challenge, if you would like to have a better understanding 56 of the language, try to re-implement the solution in pure `Bash`, 57 without using any external tools. Note that there are some types of 58 problems that bash cannot solve, such as performing floating point 59 arithmetic and manipulating dates: for those, you must call out to an 60 external tool. 61 62 ## Submitting Incomplete Solutions 63 It's possible to submit an incomplete solution so you can see how others 64 have completed the exercise.