From 3b61491cbb55a2b43bdd9b0e156e982f2e711a7e Mon Sep 17 00:00:00 2001 From: dwrz Date: Fri, 12 Nov 2021 21:16:26 +0000 Subject: [PATCH] Add python/raindrops --- python/raindrops/HELP.md | 55 ++++++++++++++ python/raindrops/README.md | 43 +++++++++++ .../__pycache__/raindrops.cpython-39.pyc | Bin 0 -> 682 bytes ...raindrops_test.cpython-39-pytest-6.2.5.pyc | Bin 0 -> 4742 bytes python/raindrops/raindrops.py | 21 ++++++ python/raindrops/raindrops_test.py | 69 ++++++++++++++++++ 6 files changed, 188 insertions(+) create mode 100644 python/raindrops/HELP.md create mode 100644 python/raindrops/README.md create mode 100644 python/raindrops/__pycache__/raindrops.cpython-39.pyc create mode 100644 python/raindrops/__pycache__/raindrops_test.cpython-39-pytest-6.2.5.pyc create mode 100644 python/raindrops/raindrops.py create mode 100644 python/raindrops/raindrops_test.py diff --git a/python/raindrops/HELP.md b/python/raindrops/HELP.md new file mode 100644 index 0000000..ae2a817 --- /dev/null +++ b/python/raindrops/HELP.md @@ -0,0 +1,55 @@ +# Help + +## Running the tests + +To run the included *tests*, run the test file using the `pytest` module, replacing `{exercise_name}`: + +```bash +$ python3 -m pytest {exercise_name}_test.py +``` + +Many IDE's and code editors have built-in support for using Pytest to run tests; check them out [here](https://github.com/exercism/python/blob/main/docs/TOOLS.md#editors-and-ides). + +For more information about running tests using `pytest`, checkout our [Python testing guide](https://github.com/exercism/python/blob/main/docs/TESTS.md#pytest). + +### Common pytest options + +- `-v` : enable verbose output. +- `-x` : stop running tests on first failure. +- `--ff` : run failures from previous test before running other test cases. + +For other options, see `python3 -m pytest -h`. + +## Submitting your solution + +You can submit your solution using the `exercism submit raindrops.py` command. +This command will upload your solution to the Exercism website and print the solution page's URL. + +It's possible to submit an incomplete solution which allows you to: + +- See how others have completed the exercise +- Request help from a mentor + +## Need to get help? + +If you'd like help solving the exercise, check the following pages: + +- The [Python track's documentation](https://exercism.org/docs/tracks/python) +- [Exercism's support channel on gitter](https://gitter.im/exercism/support) +- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) + +Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. + +Below are some resources for getting help if you run into trouble: + +- [The PSF](https://www.python.org) hosts Python downloads, documentation, and community resources. +- [Python Community on Discord](https://pythondiscord.com/) is a very helpful and active community. +- [#python on Libera.chat](https://www.python.org/community/irc/) this is where the cored developers for the language hang out and get work done. +- [Exercism on Gitter](https://gitter.im/exercism/home) join the Python room for Python-related questions or problems. +- [/r/learnpython/](https://www.reddit.com/r/learnpython/) is a subreddit designed for Python learners. +- [Python Community Forums](https://discuss.python.org/) +- [Pythontutor](http://pythontutor.com/) for stepping through small code snippets visually. + + +Additionally, [StackOverflow](http://stackoverflow.com/questions/tagged/python) is a good spot to search for your problem/question to see if it has been answered already. + If not - you can always [ask](https://stackoverflow.com/help/how-to-ask) or [answer](https://stackoverflow.com/help/how-to-answer) someone else's question. \ No newline at end of file diff --git a/python/raindrops/README.md b/python/raindrops/README.md new file mode 100644 index 0000000..21cca67 --- /dev/null +++ b/python/raindrops/README.md @@ -0,0 +1,43 @@ +# Raindrops + +Welcome to Raindrops on Exercism's Python Track. +If you need help running the tests or submitting your code, check out `HELP.md`. + +## Instructions + +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). + +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 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". + +## Source + +### Contributed to by + +- @behrtam +- @BethanyG +- @bsoyka +- @cmccandless +- @Dog +- @ikhadykin +- @kytrinyx +- @lowks +- @N-Parsons +- @pheanex +- @sjakobi +- @tqa236 +- @yawpitch + +### Based on + +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. - https://en.wikipedia.org/wiki/Fizz_buzz \ No newline at end of file diff --git a/python/raindrops/__pycache__/raindrops.cpython-39.pyc b/python/raindrops/__pycache__/raindrops.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7b6d7028339b8def1ea267084ebf94687cc86554 GIT binary patch literal 682 zcmb7Cy-ve05VrHvpU_H73`}0TG-84QA*2dMREbU*h)nFZ7L6U*ZlP7XF(O`oC*YCD z%G6h2;*zGcO9xK6Pv_5<%YApI?RJ2`YG3d4#zE-2IP4p6=o;J{127aJhMDtVU;~gC>(Fc6J#4wAaMcUg4 zE%YB$dQfOU!2TgNM}u{taSe`gzdwQT+^+rVK;>v%uVN)fpQz*JwM|ozUrsjnnHUMH zn~+t)&sjKDDG%ARUWELG>qM9|%;t8iWVqdm*+t!Kp4Y40dQili0wCAJp3}k&?BRV3 m9NmW7yN;9Bq`Yytc~DoyK25Pi&;12#^SP)1 literal 0 HcmV?d00001 diff --git a/python/raindrops/__pycache__/raindrops_test.cpython-39-pytest-6.2.5.pyc b/python/raindrops/__pycache__/raindrops_test.cpython-39-pytest-6.2.5.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da5615723c026d2be668ccd53c6bbec2b2600e20 GIT binary patch literal 4742 zcmb_g&2!sC6qn>L`77UPNkb@2TZ*Sc9NTdW9q5EfnO>Mo2LcCOc2vI&5w#_=l1Y={ z)}HwbIJC$7A^a1%a_S5huAF#pZObai*;<1!?LSRT z`-3|1D~p{2{QAczKm)y}S-R9lKVxXR*3Viwee_G-%HuCauh2IwQ`a7Akb&$=4YEA{ zWAR1CD)BPpo*Ci^&%dg?#<8G(tJU&v(6V+^)5Aj7bARR{=+ce&Wnkw3zy5D1xCCGs zpo8&JvofPetSsapkN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