diff --git a/docs/EXERCISE_README_INSERT.md b/docs/EXERCISE_README_INSERT.md index 7093c222f4..1e4f9a0d9b 100644 --- a/docs/EXERCISE_README_INSERT.md +++ b/docs/EXERCISE_README_INSERT.md @@ -1,9 +1,8 @@ -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/accumulate/README.md b/exercises/accumulate/README.md index d7fc237b0e..d801cda1d1 100644 --- a/exercises/accumulate/README.md +++ b/exercises/accumulate/README.md @@ -25,16 +25,12 @@ Keep your hands off that collect/map/fmap/whatchamacallit functionality provided by your standard library! Solve this one yourself using other basic tools instead. -Lisp specific: it's perfectly fine to use `MAPCAR` or the equivalent, -as this is idiomatic Lisp, not a library function. - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/acronym/README.md b/exercises/acronym/README.md index a30d7442d5..d172c2c75d 100644 --- a/exercises/acronym/README.md +++ b/exercises/acronym/README.md @@ -7,14 +7,12 @@ Techies love their TLA (Three Letter Acronyms)! Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG). - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/all-your-base/README.md b/exercises/all-your-base/README.md index 8d206b1278..5d4a43a637 100644 --- a/exercises/all-your-base/README.md +++ b/exercises/all-your-base/README.md @@ -6,6 +6,7 @@ Implement general base conversion. Given a number in base **a**, represented as a sequence of digits, convert it to base **b**. ## Note + - Try to implement the conversion yourself. Do not use something else to perform the conversion for you. @@ -28,16 +29,14 @@ The number 1120, *in base 3*, means: I think you got the idea! - *Yes. Those three numbers above are exactly the same. Congratulations!* -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/allergies/README.md b/exercises/allergies/README.md index d496b24e34..bc0814567f 100644 --- a/exercises/allergies/README.md +++ b/exercises/allergies/README.md @@ -29,14 +29,12 @@ allergens that score 256, 512, 1024, etc.). Your program should ignore those components of the score. For example, if the allergy score is 257, your program should only report the eggs (1) allergy. - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/alphametics/README.md b/exercises/alphametics/README.md index c988424b5a..96ba3a2b84 100644 --- a/exercises/alphametics/README.md +++ b/exercises/alphametics/README.md @@ -7,7 +7,7 @@ letters in words are replaced with numbers. For example `SEND + MORE = MONEY`: -``` +```text S E N D M O R E + ----------- @@ -16,7 +16,7 @@ M O N E Y Replacing these with valid numbers gives: -``` +```text 9 5 6 7 1 0 8 5 + ----------- @@ -31,13 +31,12 @@ a multi-digit number must not be zero. Write a function to solve alphametics puzzles. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/anagram/README.md b/exercises/anagram/README.md index bbd379b0a6..35f96af1b8 100644 --- a/exercises/anagram/README.md +++ b/exercises/anagram/README.md @@ -6,13 +6,12 @@ Given `"listen"` and a list of candidates like `"enlists" "google" "inlets" "banana"` the program should return a list containing `"inlets"`. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/atbash-cipher/README.md b/exercises/atbash-cipher/README.md index 020acf3b5f..40f0d0f76c 100644 --- a/exercises/atbash-cipher/README.md +++ b/exercises/atbash-cipher/README.md @@ -9,7 +9,7 @@ letter, the second with the second-last, and so on. An Atbash cipher for the Latin alphabet would be as follows: -```plain +```text Plain: abcdefghijklmnopqrstuvwxyz Cipher: zyxwvutsrqponmlkjihgfedcba ``` @@ -23,17 +23,17 @@ being 5 letters, and punctuation is excluded. This is to make it harder to guess things based on word boundaries. ## Examples + - Encoding `test` gives `gvhg` - Decoding `gvhg` gives `test` - Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/beer-song/README.md b/exercises/beer-song/README.md index cf5c6ed03d..6cbb8668ad 100644 --- a/exercises/beer-song/README.md +++ b/exercises/beer-song/README.md @@ -4,7 +4,7 @@ Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles Note that not all verses are identical. -```plain +```text 99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles of beer on the wall. @@ -320,13 +320,12 @@ are some additional things you could try: Then please share your thoughts in a comment on the submission. Did this experiment make the code better? Worse? Did you learn anything from it? -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/binary-search/README.md b/exercises/binary-search/README.md index 46d6bf69dc..eae22e71b5 100644 --- a/exercises/binary-search/README.md +++ b/exercises/binary-search/README.md @@ -34,13 +34,12 @@ A binary search halves the number of items to check with each iteration, so locating an item (or determining its absence) takes logarithmic time. A binary search is a dichotomic divide and conquer search algorithm. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/binary/README.md b/exercises/binary/README.md index a067ea4e91..9643543cba 100644 --- a/exercises/binary/README.md +++ b/exercises/binary/README.md @@ -7,10 +7,12 @@ string, your program should produce a decimal output. The program should handle invalid inputs. ## Note + - Implement the conversion yourself. Do not use something else to perform the conversion for you. ## About Binary (Base-2) + Decimal is a base-10 system. A number 23 in base 10 notation can be understood @@ -28,13 +30,12 @@ Binary is similar, but uses powers of 2 rather than powers of 10. So: `101 => 1*2^2 + 0*2^1 + 1*2^0 => 1*4 + 0*2 + 1*1 => 4 + 1 => 5 base 10`. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/bob/README.md b/exercises/bob/README.md index a0036cbcc9..181f8a6f72 100644 --- a/exercises/bob/README.md +++ b/exercises/bob/README.md @@ -11,13 +11,12 @@ anything. He answers 'Whatever.' to anything else. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/book-store/README.md b/exercises/book-store/README.md index ca9df446bd..7672c9d101 100644 --- a/exercises/book-store/README.md +++ b/exercises/book-store/README.md @@ -3,20 +3,20 @@ To try and encourage more sales of different books from a popular 5 book series, a bookshop has decided to offer discounts on multiple book purchases. -One copy of any of the five books costs $8. +One copy of any of the five books costs $8. If, however, you buy two different books, you get a 5% discount on those two books. -If you buy 3 different books, you get a 10% discount. +If you buy 3 different books, you get a 10% discount. If you buy 4 different books, you get a 20% discount. -If you buy all 5, you get a 25% discount. +If you buy all 5, you get a 25% discount. Note: that if you buy four books, of which 3 are different titles, you get a 10% discount on the 3 that -form part of a set, but the fourth book still costs $8. +form part of a set, but the fourth book still costs $8. Your mission is to write a piece of code to calculate the price of any conceivable shopping basket (containing only @@ -30,7 +30,7 @@ For example, how much does this basket of books cost? - 2 copies of the third book - 1 copy of the fourth book - 1 copy of the fifth book - + One way of grouping these 8 books is: - 1 group of 5 --> 25% discount (1st,2nd,3rd,4th,5th) @@ -67,13 +67,12 @@ For a total of $51.20 And $51.20 is the price with the biggest discount. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/bracket-push/README.md b/exercises/bracket-push/README.md index d43cd3c19a..a1afd7efd2 100644 --- a/exercises/bracket-push/README.md +++ b/exercises/bracket-push/README.md @@ -3,13 +3,12 @@ Given a string containing brackets `[]`, braces `{}` and parentheses `()`, verify that all the pairs are matched and nested correctly. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/change/README.md b/exercises/change/README.md index 01ae9e1cc4..9375ea3045 100644 --- a/exercises/change/README.md +++ b/exercises/change/README.md @@ -16,19 +16,18 @@ that the sum of the coins' value would equal the correct amount of change. - Can you ask for negative change? - Can you ask for a change value smaller than the smallest coin value? -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). ## Source -Software Craftsmanship - Kata-logue [http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata](http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata) +Software Craftsmanship - Coin Change Kata [https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata](https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata) ## Submitting Incomplete Solutions It's possible to submit an incomplete solution so you can see how others have completed the exercise. diff --git a/exercises/circular-buffer/README.md b/exercises/circular-buffer/README.md index 98f80dc4df..5f27d2d6b0 100644 --- a/exercises/circular-buffer/README.md +++ b/exercises/circular-buffer/README.md @@ -31,25 +31,31 @@ If the buffer has 7 elements then it is completely full: When the buffer is full an error will be raised, alerting the client that further writes are blocked until a slot becomes free. -The client can opt to overwrite the oldest data with a forced write. In -this case, two more elements — A & B — are added and they overwrite the -3 & 4: +When the buffer is full, the client can opt to overwrite the oldest +data with a forced write. In this case, two more elements — A & B — +are added and they overwrite the 3 & 4: [6][7][8][9][A][B][5] -Finally, if two elements are now removed then what would be returned is -not 3 & 4 but 5 & 6 because A & B overwrote the 3 & the 4 yielding the -buffer with: +3 & 4 have been replaced by A & B making 5 now the oldest data in the +buffer. Finally, if two elements are removed then what would be +returned is 5 & 6 yielding the buffer: [ ][7][8][9][A][B][ ] -### Submitting Exercises +Because there is space available, if the client again uses overwrite +to store C & D then the space where 5 & 6 were stored previously will +be used not the location of 7 & 8. 7 is still the oldest element and +the buffer is once again full. + + [D][7][8][9][A][B][C] + +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/clock/README.md b/exercises/clock/README.md index 5a24eca592..6c945a0224 100644 --- a/exercises/clock/README.md +++ b/exercises/clock/README.md @@ -6,13 +6,12 @@ You should be able to add and subtract minutes to it. Two clocks that represent the same time should be equal to each other. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/collatz-conjecture/.meta/hints.md b/exercises/collatz-conjecture/.meta/hints.md new file mode 100644 index 0000000000..47ebd98f6d --- /dev/null +++ b/exercises/collatz-conjecture/.meta/hints.md @@ -0,0 +1,3 @@ +## Notes + +The Collatz Conjecture is only concerned with strictly positive integers, so your solution should return `None` if given 0 or a negative integer. diff --git a/exercises/collatz-conjecture/README.md b/exercises/collatz-conjecture/README.md index 6b2ede8b2b..a4f625424a 100644 --- a/exercises/collatz-conjecture/README.md +++ b/exercises/collatz-conjecture/README.md @@ -9,25 +9,8 @@ always reach 1 eventually. Given a number n, return the number of steps required to reach 1. -(Keep in mind that the Conjecture is only concerned with strictly positive -integers, so your solution should return `None` if given 0 or a negative -integer.) - ## Examples -Starting with n = 3, the steps would be as follows: - -0. 3 -1. 10 -2. 5 -3. 16 -4. 8 -5. 4 -6. 2 -7. 1 - -Resulting in 7 steps. So for input n = 3, the return value would be 7. - Starting with n = 12, the steps would be as follows: 0. 12 @@ -43,13 +26,17 @@ Starting with n = 12, the steps would be as follows: Resulting in 9 steps. So for input n = 12, the return value would be 9. -### Submitting Exercises +## Notes + +The Collatz Conjecture is only concerned with strictly positive integers, so your solution should raise a `ValueError` with a meaningful message if given 0 or a negative integer. + + +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/complex-numbers/README.md b/exercises/complex-numbers/README.md index 8a99bb3d02..63999ab85d 100644 --- a/exercises/complex-numbers/README.md +++ b/exercises/complex-numbers/README.md @@ -2,15 +2,41 @@ A complex number is a number in the form `a + b * i` where `a` and `b` are real and `i` satisfies `i^2 = -1`. +`a` is called the real part and `b` is called the imaginary part of `z`. +The conjugate of the number `a + b * i` is the number `a - b * i`. +The absolute value of a complex number `z = a + b * i` is a real number `|z| = sqrt(a^2 + b^2)`. The square of the absolute value `|z|^2` is the result of multiplication of `z` by its complex conjugate. + +The sum/difference of two complex numbers involves adding/subtracting their real and imaginary parts separately: +`(a + i * b) + (c + i * d) = (a + c) + (b + d) * i`, +`(a + i * b) - (c + i * d) = (a - c) + (b - d) * i`. + +Multiplication result is by definition +`(a + i * b) * (c + i * d) = (a * c - b * d) + (b * c + a * d) * i`. + +The reciprocal of a non-zero complex number is +`1 / (a + i * b) = a/(a^2 + b^2) - b/(a^2 + b^2) * i`. + +Dividing a complex number `a + i * b` by another `c + i * d` gives: +`(a + i * b) / (c + i * d) = (a * c + b * d)/(c^2 + d^2) + (b * c - a * d)/(c^2 + d^2) * i`. + +Exponent of a complex number can be expressed as +`exp(a + i * b) = exp(a) * exp(i * b)`, +and the last term is given by Euler's formula `exp(i * b) = cos(b) + i * sin(b)`. + + +Implement the following operations: + - addition, subtraction, multiplication and division of two complex numbers, + - conjugate, absolute value, exponent of a given complex number. + + Assume the programming language you are using does not have an implementation of complex numbers. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/crypto-square/README.md b/exercises/crypto-square/README.md index ea3c4456c0..669cb8762d 100644 --- a/exercises/crypto-square/README.md +++ b/exercises/crypto-square/README.md @@ -26,7 +26,7 @@ and `r` is the number of rows. Our normalized text is 54 characters long, dictating a rectangle with `c = 8` and `r = 7`: -```plain +```text ifmanwas meanttos tayonthe @@ -41,22 +41,24 @@ right. The message above is coded as: -```plain +```text imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau ``` -Output the encoded text in chunks. Phrases that fill perfect squares -`(r X r)` should be output in `r`-length chunks separated by spaces. -Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows. +Output the encoded text in chunks. Phrases that fill perfect rectangles +`(r X c)` should be output `c` chunks of `r` length, separated by spaces. +Phrases that do not fill perfect rectangles will have `n` empty spaces. +Those spaces should be distributed evenly, added to the end of the last +`n` chunks. -```plain -imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau +```text +imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ``` Notice that were we to stack these, we could visually decode the cyphertext back in to the original message: -```plain +```text imtgdvs fearwer mayoogo @@ -67,13 +69,12 @@ aohghn sseoau ``` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/diamond/README.md b/exercises/diamond/README.md index bb39dc5b82..d79e998476 100644 --- a/exercises/diamond/README.md +++ b/exercises/diamond/README.md @@ -1,7 +1,7 @@ # Diamond -The diamond kata takes as its input a letter, and outputs it in a diamond -shape. Given a letter, it prints a diamond starting with 'A', with the +The diamond kata takes as its input a letter, and outputs it in a diamond +shape. Given a letter, it prints a diamond starting with 'A', with the supplied letter at the widest point. ## Requirements @@ -15,7 +15,7 @@ supplied letter at the widest point. * The diamond has a square shape (width equals height). * The letters form a diamond shape. * The top half has the letters in ascending order. -* The bottom half has the letters in descending order. +* The bottom half has the letters in descending order. * The four corners (containing the spaces) are triangles. ## Examples @@ -24,13 +24,13 @@ In the following examples, spaces are indicated by `·` characters. Diamond for letter 'A': -```plain +```text A ``` Diamond for letter 'C': -```plain +```text ··A·· ·B·B· C···C @@ -40,7 +40,7 @@ C···C Diamond for letter 'E': -```plain +```text ····A···· ···B·B··· ··C···C·· @@ -52,13 +52,12 @@ E·······E ····A···· ``` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/difference-of-squares/README.md b/exercises/difference-of-squares/README.md index eb0c3aaf8f..84015f4cc3 100644 --- a/exercises/difference-of-squares/README.md +++ b/exercises/difference-of-squares/README.md @@ -12,13 +12,12 @@ Hence the difference between the square of the sum of the first ten natural numbers and the sum of the squares of the first ten natural numbers is 3025 - 385 = 2640. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/diffie-hellman/.meta/hints.md b/exercises/diffie-hellman/.meta/hints.md index c3f8575374..92a62021a8 100644 --- a/exercises/diffie-hellman/.meta/hints.md +++ b/exercises/diffie-hellman/.meta/hints.md @@ -13,4 +13,4 @@ For this reason, in version 3.6, Python introduced the `secrets` module, which g cryptographically strong random numbers that provide the greater security required for cryptography. Since this is only an exercise, `random` is fine to use, but note that **it would be -very insecure if actually used for cryptography.** +very insecure if actually used for cryptography.** \ No newline at end of file diff --git a/exercises/diffie-hellman/README.md b/exercises/diffie-hellman/README.md index d4a5f867a0..5db2f7404a 100644 --- a/exercises/diffie-hellman/README.md +++ b/exercises/diffie-hellman/README.md @@ -54,15 +54,16 @@ cryptographically strong random numbers that provide the greater security requir Since this is only an exercise, `random` is fine to use, but note that **it would be very insecure if actually used for cryptography.** -### Submitting Exercises + +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). + ## Source Wikipedia, 1024 bit key from www.cryptopp.com/wiki. [http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange](http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) diff --git a/exercises/etl/README.md b/exercises/etl/README.md index ce03569f59..498596d4fc 100644 --- a/exercises/etl/README.md +++ b/exercises/etl/README.md @@ -3,6 +3,7 @@ We are going to do the `Transform` step of an Extract-Transform-Load. ### ETL + Extract-Transform-Load (ETL) is a fancy way of saying, "We have some crufty, legacy data over in this system, and now we need it in this shiny new system over here, so we're going to migrate this." @@ -11,6 +12,7 @@ once." That's then typically followed by much forehead slapping and moaning about how stupid we could possibly be.) ### The goal + We're going to extract some scrabble scores from a legacy system. The old system stored a list of letters per score: @@ -44,13 +46,12 @@ variety of languages, each with its own unique scoring table. For example, an "E" is scored at 2 in the Māori-language version of the game while being scored at 4 in the Hawaiian-language version. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/flatten-array/README.md b/exercises/flatten-array/README.md index e46a09197c..96540ebdf3 100644 --- a/exercises/flatten-array/README.md +++ b/exercises/flatten-array/README.md @@ -3,21 +3,19 @@ Take a nested list and return a single flattened list with all values except nil/null. The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values. - + For Example input: [1,[2,3,null,4],[null],5] output: [1,2,3,4,5] - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/food-chain/README.md b/exercises/food-chain/README.md index f45555ddeb..22c711a711 100644 --- a/exercises/food-chain/README.md +++ b/exercises/food-chain/README.md @@ -1,4 +1,4 @@ -# Food chain +# Food Chain Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'. @@ -63,19 +63,18 @@ I know an old lady who swallowed a horse. She's dead, of course! ``` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). ## Source -Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup) +Wikipedia [http://en.wikipedia.org/wiki/There_Was_an_Old_Lady_Who_Swallowed_a_Fly](http://en.wikipedia.org/wiki/There_Was_an_Old_Lady_Who_Swallowed_a_Fly) ## Submitting Incomplete Solutions It's possible to submit an incomplete solution so you can see how others have completed the exercise. diff --git a/exercises/forth/README.md b/exercises/forth/README.md index e987a4ac25..2020976f71 100644 --- a/exercises/forth/README.md +++ b/exercises/forth/README.md @@ -25,19 +25,15 @@ enough.) Words are case-insensitive. -## Hints -- To parse the text, you could try to use the [Sprache](https://github.com/sprache/Sprache/blob/develop/README.md) library. You can also find a good tutorial [here](https://www.thomaslevesque.com/2017/02/23/easy-text-parsing-in-c-with-sprache/). - - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). + ## Submitting Incomplete Solutions It's possible to submit an incomplete solution so you can see how others have completed the exercise. diff --git a/exercises/gigasecond/README.md b/exercises/gigasecond/README.md index 73007b9305..5add08a5ee 100644 --- a/exercises/gigasecond/README.md +++ b/exercises/gigasecond/README.md @@ -4,13 +4,12 @@ Calculate the moment when someone has lived for 10^9 seconds. A gigasecond is 10^9 (1,000,000,000) seconds. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/grade-school/README.md b/exercises/grade-school/README.md index 886ea84bb6..7df5b67b29 100644 --- a/exercises/grade-school/README.md +++ b/exercises/grade-school/README.md @@ -21,7 +21,6 @@ In the end, you should be able to: Note that all our students only have one name. (It's a small town, what do you want?) - ## For bonus points Did you get the tests passing and the code clean? If you want to, these @@ -35,13 +34,12 @@ are some additional things you could try: Then please share your thoughts in a comment on the submission. Did this experiment make the code better? Worse? Did you learn anything from it? -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/grains/README.md b/exercises/grains/README.md index a5c10a836a..30a5b1d142 100644 --- a/exercises/grains/README.md +++ b/exercises/grains/README.md @@ -15,7 +15,6 @@ Write code that shows: - how many grains were on each square, and - the total number of grains - ## For bonus points Did you get the tests passing and the code clean? If you want to, these @@ -27,13 +26,12 @@ are some additional things you could try: Then please share your thoughts in a comment on the submission. Did this experiment make the code better? Worse? Did you learn anything from it? -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/grep/README.md b/exercises/grep/README.md index 01e84aedfe..a0acd728df 100644 --- a/exercises/grep/README.md +++ b/exercises/grep/README.md @@ -3,14 +3,14 @@ Search a file for lines matching a regular expression pattern. Return the line number and contents of each matching line. -The Unix [`grep`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html) command can be used to search for lines in one or more files +The Unix [`grep`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html) command can be used to search for lines in one or more files that match a user-provided search query (known as the *pattern*). The `grep` command takes three arguments: -1. The pattern used to match lines in a file. +1. The pattern used to match lines in a file. 2. Zero or more flags to customize the matching behavior. -3. One or more files in which to search for matching lines. +3. One or more files in which to search for matching lines. Your task is to implement the `grep` function, which should read the contents of the specified files, find the lines that match the specified pattern @@ -20,18 +20,18 @@ in the first file being output first. As an example, suppose there is a file named "input.txt" with the following contents: -
+```text
 hello
 world
 hello again
-
+``` If we were to call `grep "hello" input.txt`, the returned string should be: -
+```text
 hello
 hello again
-
+``` ### Flags @@ -46,31 +46,30 @@ As said earlier, the `grep` command should also support the following flags: If we run `grep -n "hello" input.txt`, the `-n` flag will require the matching lines to be prefixed with its line number: -
+```text
 1:hello
 3:hello again
-
+``` -And if we run `grep -i "HELLO" input.txt`, we'll do a case-insensitive match, +And if we run `grep -i "HELLO" input.txt`, we'll do a case-insensitive match, and the output will be: -
+```text
 hello
 hello again
-
+``` The `grep` command should support multiple flags at once. For example, running `grep -l -v "hello" file1.txt file2.txt` should print the names of files that do not contain the string "hello". -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/hamming/README.md b/exercises/hamming/README.md index c564286862..b5c68ad05a 100644 --- a/exercises/hamming/README.md +++ b/exercises/hamming/README.md @@ -35,13 +35,12 @@ The Hamming distance is only defined for sequences of equal length. This means that based on the definition, each language could deal with getting sequences of equal length differently. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/hello-world/README.md b/exercises/hello-world/README.md index e9e7aad3f9..d6e94bf7e0 100644 --- a/exercises/hello-world/README.md +++ b/exercises/hello-world/README.md @@ -14,13 +14,12 @@ The objectives are simple: If everything goes well, you will be ready to fetch your first real exercise. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/hexadecimal/README.md b/exercises/hexadecimal/README.md index 4d690e5508..0ac11a3861 100644 --- a/exercises/hexadecimal/README.md +++ b/exercises/hexadecimal/README.md @@ -7,13 +7,12 @@ teal: 008080, navy: 000080). The program should handle invalid hexadecimal strings. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/house/README.md b/exercises/house/README.md index c68367f5ce..3661dd19d9 100644 --- a/exercises/house/README.md +++ b/exercises/house/README.md @@ -11,10 +11,9 @@ Output the nursery rhyme 'This is the House that Jack Built'. - [papyr.com](http://papyr.com/hypertextbooks/grammar/ph_noun.htm) - The nursery rhyme reads as follows: -```plain +```text This is the house that Jack built. This is the malt @@ -106,13 +105,12 @@ that ate the malt that lay in the house that Jack built. ``` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/isogram/README.md b/exercises/isogram/README.md index 6412b8d904..58c3482063 100644 --- a/exercises/isogram/README.md +++ b/exercises/isogram/README.md @@ -2,23 +2,23 @@ Determine if a word or phrase is an isogram. -An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter. +An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times. Examples of isograms: - lumberjacks - background - downstream +- six-year-old The word *isograms*, however, is not an isogram, because the s repeats. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/kindergarten-garden/README.md b/exercises/kindergarten-garden/README.md index 5b7ed11762..c8ddd3713a 100644 --- a/exercises/kindergarten-garden/README.md +++ b/exercises/kindergarten-garden/README.md @@ -3,19 +3,19 @@ Given a diagram, determine which plants each child in the kindergarten class is responsible for. -The kindergarten class is learning about growing plants. The teachers +The kindergarten class is learning about growing plants. The teacher thought it would be a good idea to give them actual seeds, plant them in actual dirt, and grow actual plants. They've chosen to grow grass, clover, radishes, and violets. -To this end, they've put little styrofoam cups along the window sills, -and planted one type of plant in each cup, choosing randomly from the -available types of seeds. +To this end, the children have put little cups along the window sills, and +planted one type of plant in each cup, choosing randomly from the available +types of seeds. -```plain +```text [window][window][window] -........................ # each dot represents a styrofoam cup +........................ # each dot represents a cup ........................ ``` @@ -25,27 +25,27 @@ There are 12 children in the class: - Eve, Fred, Ginny, Harriet, - Ileana, Joseph, Kincaid, and Larry. -Each child gets 4 cups, two on each row. The children are assigned to -cups in alphabetical order. +Each child gets 4 cups, two on each row. Their teacher assigns cups to +the children alphabetically by their names. The following diagram represents Alice's plants: -```plain +```text [window][window][window] VR...................... RG...................... ``` -So in the row nearest the window, she has a violet and a radish; in the -row behind that, she has a radish and some grass. +In the first row, nearest the windows, she has a violet and a radish. In the +second row she has a radish and some grass. Your program will be given the plants from left-to-right starting with the row nearest the windows. From this, it should be able to determine -which plants belong to which students. +which plants belong to each student. For example, if it's told that the garden looks like so: -```plain +```text [window][window][window] VRCGVVRVCGGCCGVRGCVCGCGV VRCCCGCRRGVCGCRVVCVGCGCV @@ -59,13 +59,12 @@ While asking for Bob's plants would yield: - Clover, grass, clover, clover -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/largest-series-product/README.md b/exercises/largest-series-product/README.md index 9aa0984a9b..63032f7c2c 100644 --- a/exercises/largest-series-product/README.md +++ b/exercises/largest-series-product/README.md @@ -13,13 +13,12 @@ in the input; the digits need not be *numerically consecutive*. For the input `'73167176531330624919225119674426574742355349194934'`, the largest product for a series of 6 digits is 23520. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/leap/README.md b/exercises/leap/README.md index 4bbebf3618..91c9a51cb2 100644 --- a/exercises/leap/README.md +++ b/exercises/leap/README.md @@ -4,7 +4,7 @@ Given a year, report if it is a leap year. The tricky thing here is that a leap year in the Gregorian calendar occurs: -```plain +```text on every year that is evenly divisible by 4 except every year that is evenly divisible by 100 unless the year is also evenly divisible by 400 @@ -26,13 +26,12 @@ phenomenon, go watch [this youtube video][video]. [video]: http://www.youtube.com/watch?v=xX96xng7sAE -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/linked-list/README.md b/exercises/linked-list/README.md index 5f6c22c157..12c85fab2e 100644 --- a/exercises/linked-list/README.md +++ b/exercises/linked-list/README.md @@ -2,18 +2,18 @@ Implement a doubly linked list. -Like an array, a linked list is a simple linear data structure. Several -common data types can be implemented using linked lists, like queues, +Like an array, a linked list is a simple linear data structure. Several +common data types can be implemented using linked lists, like queues, stacks, and associative arrays. -A linked list is a collection of data elements called *nodes*. In a -*singly linked list* each node holds a value and a link to the next node. -In a *doubly linked list* each node also holds a link to the previous +A linked list is a collection of data elements called *nodes*. In a +*singly linked list* each node holds a value and a link to the next node. +In a *doubly linked list* each node also holds a link to the previous node. -You will write an implementation of a doubly linked list. Implement a -Node to hold a value and pointers to the next and previous nodes. Then -implement a List which holds references to the first and last node and +You will write an implementation of a doubly linked list. Implement a +Node to hold a value and pointers to the next and previous nodes. Then +implement a List which holds references to the first and last node and offers an array-like interface for adding and removing items: * `push` (*insert value at back*); @@ -21,19 +21,18 @@ offers an array-like interface for adding and removing items: * `shift` (*remove value at front*). * `unshift` (*insert value at front*); -To keep your implementation simple, the tests will not cover error -conditions. Specifically: `pop` or `shift` will never be called on an +To keep your implementation simple, the tests will not cover error +conditions. Specifically: `pop` or `shift` will never be called on an empty list. If you want to know more about linked lists, check [Wikipedia](https://en.wikipedia.org/wiki/Linked_list). -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/list-ops/README.md b/exercises/list-ops/README.md index c603f0f2c9..8b85aef8bb 100644 --- a/exercises/list-ops/README.md +++ b/exercises/list-ops/README.md @@ -6,13 +6,12 @@ In functional languages list operations like `length`, `map`, and `reduce` are very common. Implement a series of basic list operations, without using existing functions. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/luhn/README.md b/exercises/luhn/README.md index 489dcd7592..4f60eee727 100644 --- a/exercises/luhn/README.md +++ b/exercises/luhn/README.md @@ -18,27 +18,27 @@ are disallowed. ## Example 1: valid credit card number -``` +```text 4539 1488 0343 6467 ``` The first step of the Luhn algorithm is to double every second digit, starting from the right. We will be doubling -``` +```text 4_3_ 1_8_ 0_4_ 6_6_ ``` If doubling the number results in a number greater than 9 then subtract 9 from the product. The results of our doubling: -``` +```text 8569 2478 0383 3437 ``` Then sum all of the digits: -``` +```text 8+5+6+9+2+4+7+8+0+3+8+3+3+4+3+7 = 80 ``` @@ -46,31 +46,30 @@ If the sum is evenly divisible by 10, then the number is valid. This number is v ## Example 2: invalid credit card number -``` +```text 8273 1232 7352 0569 ``` Double the second digits, starting from the right -``` +```text 7253 2262 5312 0539 ``` Sum the digits -``` +```text 7+2+5+3+2+2+6+2+5+3+1+2+0+5+3+9 = 57 ``` 57 is not evenly divisible by 10, so this number is not valid. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/markdown/README.md b/exercises/markdown/README.md index 8a772cb3fc..e9db4ea49f 100644 --- a/exercises/markdown/README.md +++ b/exercises/markdown/README.md @@ -12,19 +12,14 @@ It would be helpful if you made notes of what you did in your refactoring in comments so reviewers can see that, but it isn't strictly necessary. The most important thing is to make the code better! -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). -## Source - -Syntax [https://guides.github.com/features/mastering-markdown/](https://guides.github.com/features/mastering-markdown/) - ## Submitting Incomplete Solutions It's possible to submit an incomplete solution so you can see how others have completed the exercise. diff --git a/exercises/matrix/README.md b/exercises/matrix/README.md index 492cbdacf2..faf5cca5ed 100644 --- a/exercises/matrix/README.md +++ b/exercises/matrix/README.md @@ -5,13 +5,15 @@ that matrix. So given a string with embedded newlines like: -> 9 8 7 -> 5 3 2 -> 6 6 7 +```text +9 8 7 +5 3 2 +6 6 7 +``` representing this matrix: -```plain +```text 0 1 2 |--------- 0 | 9 8 7 @@ -38,13 +40,12 @@ And its columns: - 8, 3, 6 - 7, 2, 7 -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/meetup/README.md b/exercises/meetup/README.md index a4e9bff4d7..98ba81bda7 100644 --- a/exercises/meetup/README.md +++ b/exercises/meetup/README.md @@ -18,18 +18,16 @@ end in '-teenth'. Therefore, one is guaranteed that each day of the week (Monday, Tuesday, ...) will have exactly one date that is named with '-teenth' in every month. -Given examples of a meetup dates, each containing a month, day, year, and descriptor +Given examples of a meetup dates, each containing a month, day, year, and descriptor (first, second, teenth, etc), calculate the date of the actual meetup. For example, if given "First Monday of January 2017", the correct meetup date is 2017/1/2 - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/minesweeper/README.md b/exercises/minesweeper/README.md index cbec7e09fa..7aeca7a9e4 100644 --- a/exercises/minesweeper/README.md +++ b/exercises/minesweeper/README.md @@ -26,13 +26,12 @@ into this: | 111 | +-----+ -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/nth-prime/README.md b/exercises/nth-prime/README.md index 7eb36311b2..77a968f044 100644 --- a/exercises/nth-prime/README.md +++ b/exercises/nth-prime/README.md @@ -8,13 +8,12 @@ the 6th prime is 13. If your language provides methods in the standard library to deal with prime numbers, pretend they don't exist and implement them yourself. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/nucleotide-count/README.md b/exercises/nucleotide-count/README.md index e1a782851e..9d9251a3aa 100644 --- a/exercises/nucleotide-count/README.md +++ b/exercises/nucleotide-count/README.md @@ -1,38 +1,23 @@ # Nucleotide Count -Given a DNA string, compute how many times each nucleotide occurs in the string. +Given a single stranded DNA string, compute how many times each nucleotide occurs in the string. -DNA is represented by an alphabet of the following symbols: 'A', 'C', -'G', and 'T'. - -Each symbol represents a nucleotide, which is a fancy name for the -particular molecules that happen to make up a large part of DNA. - -Shortest intro to biochemistry EVAR: +The genetic language of every living thing on the planet is DNA. +DNA is a large molecule that is built from an extremely long sequence of individual elements called nucleotides. +4 types exist in DNA and these differ only slightly and can be represented as the following symbols: 'A' for adenine, 'C' for cytosine, 'G' for guanine, and 'T' thymine. +Here is an analogy: - twigs are to birds nests as -- nucleotides are to DNA and RNA as -- amino acids are to proteins as -- sugar is to starch as -- oh crap lipids - -I'm not going to talk about lipids because they're crazy complex. - -So back to nucleotides. +- nucleotides are to DNA as +- legos are to lego houses as +- words are to sentences as... -DNA contains four types of them: adenine (`A`), cytosine (`C`), guanine -(`G`), and thymine (`T`). - -RNA contains a slightly different set of nucleotides, but we don't care -about that for now. - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/ocr-numbers/README.md b/exercises/ocr-numbers/README.md index 7242a62d34..16d798ce3d 100644 --- a/exercises/ocr-numbers/README.md +++ b/exercises/ocr-numbers/README.md @@ -9,7 +9,7 @@ To begin with, convert a simple binary font to a string containing 0 or 1. The binary font uses pipes and underscores, four rows high and three columns wide. -``` +```text _ # | | # zero. |_| # @@ -18,7 +18,7 @@ The binary font uses pipes and underscores, four rows high and three columns wid Is converted to "0" -``` +```text # | # one. | # @@ -39,7 +39,7 @@ Update your program to recognize multi-character binary strings, replacing garbl Update your program to recognize all numbers 0 through 9, both individually and as part of a larger string. -``` +```text _ _| |_ @@ -48,7 +48,7 @@ Update your program to recognize all numbers 0 through 9, both individually and Is converted to "2" -``` +```text _ _ _ _ _ _ _ _ # | _| _||_||_ |_ ||_||_|| | # decimal numbers. ||_ _| | _||_| ||_| _||_| # @@ -61,7 +61,7 @@ Is converted to "1234567890" Update your program to handle multiple numbers, one per line. When converting several lines, join the lines with commas. -``` +```text _ _ | _| _| ||_ _| @@ -78,13 +78,12 @@ Update your program to handle multiple numbers, one per line. When converting se Is converted to "123,456,789" -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/octal/README.md b/exercises/octal/README.md index 6e1398986a..a9e096b47e 100644 --- a/exercises/octal/README.md +++ b/exercises/octal/README.md @@ -8,11 +8,13 @@ Implement octal to decimal conversion. Given an octal input string, your program should produce a decimal output. ## Note + - Implement the conversion yourself. Do not use something else to perform the conversion for you. - Treat invalid input as octal 0. ## About Octal (Base-8) + Decimal is a base-10 system. A number 233 in base 10 notation can be understood @@ -25,7 +27,8 @@ as a linear combination of powers of 10: - All these values are summed. So: -``` + +```text 233 # decimal = 2*10^2 + 3*10^1 + 3*10^0 = 2*100 + 3*10 + 3*1 @@ -34,7 +37,8 @@ So: Octal is similar, but uses powers of 8 rather than powers of 10. So: -``` + +```text 233 # octal = 2*8^2 + 3*8^1 + 3*8^0 = 2*64 + 3*8 + 3*1 @@ -42,13 +46,12 @@ So: = 155 ``` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/palindrome-products/README.md b/exercises/palindrome-products/README.md index 78e7268fab..0c85e680e0 100644 --- a/exercises/palindrome-products/README.md +++ b/exercises/palindrome-products/README.md @@ -5,41 +5,39 @@ Detect palindrome products in a given range. A palindromic number is a number that remains the same when its digits are reversed. For example, `121` is a palindromic number but `112` is not. -Given the definition of a palindromic number, we define a palindrome _product_ -to be the product `c`, such that `a * b = c`, where `c` is a palindromic number and - `a` and `b` are integers (possibly, but _not_ necessarily palindromic numbers). +Given a range of numbers, find the largest and smallest palindromes which +are products of numbers within that range. -For example, the palindromic number 9009 can be written as the palindrome -product: `91 * 99 = 9009`. - -It's possible (and indeed common) for a palindrome product to be the product -of multiple combinations of numbers. For example, the palindrome product `9` has -the factors `(1, 9)`, `(3, 3)`, and `(9, 1)`. - -Write a program that given a range of integers, returns the smallest and largest -palindromic product within that range, along with all of it's factors. +Your solution should return the largest and smallest palindromes, along with the +factors of each within the range. If the largest or smallest palindrome has more +than one pair of factors within the range, then return all the pairs. ## Example 1 Given the range `[1, 9]` (both inclusive)... -The smallest product is `1`. It's factors are `(1, 1)`. -The largest product is `9`. It's factors are `(1, 9)`, `(3, 3)`, and `(9, 1)`. +And given the list of all possible products within this range: +`[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 15, 21, 24, 27, 20, 28, 32, 36, 25, 30, 35, 40, 45, 42, 48, 54, 49, 56, 63, 64, 72, 81]` + +The palindrome products are all single digit numbers (in this case): +`[1, 2, 3, 4, 5, 6, 7, 8, 9]` + +The smallest palindrome product is `1`. Its factors are `(1, 1)`. +The largest palindrome product is `9`. Its factors are `(1, 9)` and `(3, 3)`. ## Example 2 Given the range `[10, 99]` (both inclusive)... -The smallest palindrome product is `121`. It's factors are `(11, 11)`. -The largest palindrome product is `9009`. It's factors are `(91, 99)` and `(99, 91)`. +The smallest palindrome product is `121`. Its factors are `(11, 11)`. +The largest palindrome product is `9009`. Its factors are `(91, 99)`. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/pangram/README.md b/exercises/pangram/README.md index 317b23d170..7a1541db79 100644 --- a/exercises/pangram/README.md +++ b/exercises/pangram/README.md @@ -2,19 +2,18 @@ Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma, "every letter") is a sentence using every letter of the alphabet at least once. -The best known English pangram is: +The best known English pangram is: > The quick brown fox jumps over the lazy dog. The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case insensitive. Input will not contain non-ASCII symbols. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/pascals-triangle/README.md b/exercises/pascals-triangle/README.md index 5159f03d10..8c445bf997 100644 --- a/exercises/pascals-triangle/README.md +++ b/exercises/pascals-triangle/README.md @@ -5,7 +5,7 @@ Compute Pascal's triangle up to a given number of rows. In Pascal's Triangle each number is computed by adding the numbers to the right and left of the current position in the previous row. -```plain +```text 1 1 1 1 2 1 @@ -14,13 +14,12 @@ the right and left of the current position in the previous row. # ... etc ``` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/perfect-numbers/README.md b/exercises/perfect-numbers/README.md index 0b97a231f6..ad82791f47 100644 --- a/exercises/perfect-numbers/README.md +++ b/exercises/perfect-numbers/README.md @@ -5,7 +5,7 @@ Nicomachus' (60 - 120 CE) classification scheme for natural numbers. The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) devised a classification scheme for natural numbers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum](https://en.wikipedia.org/wiki/Aliquot_sum). The aliquot sum is defined as the sum of the factors of a number not including the number itself. For example, the aliquot sum of 15 is (1 + 3 + 5) = 9 -- **Perfect**: aliquot sum = number +- **Perfect**: aliquot sum = number - 6 is a perfect number because (1 + 2 + 3) = 6 - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28 - **Abundant**: aliquot sum > number @@ -14,16 +14,15 @@ The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) d - **Deficient**: aliquot sum < number - 8 is a deficient number because (1 + 2 + 4) = 7 - Prime numbers are deficient - + Implement a way to determine whether a given number is **perfect**. Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/phone-number/README.md b/exercises/phone-number/README.md index 4c8ec456d9..2085eb9416 100644 --- a/exercises/phone-number/README.md +++ b/exercises/phone-number/README.md @@ -6,11 +6,12 @@ The **North American Numbering Plan (NANP)** is a telephone numbering system use NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*. - The format is usually represented as -``` + +```text (NXX)-NXX-XXXX ``` + where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9. Your task is to clean up differently formated telephone numbers by removing punctuation and the country code (1) if present. @@ -27,13 +28,12 @@ should all produce the output **Note:** As this exercise only deals with telephone numbers used in NANP-countries, only 1 is considered a valid country code. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/pig-latin/README.md b/exercises/pig-latin/README.md index 03f7214189..d8d7d85cd3 100644 --- a/exercises/pig-latin/README.md +++ b/exercises/pig-latin/README.md @@ -17,13 +17,12 @@ variants too. See for more details. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/point-mutations/README.md b/exercises/point-mutations/README.md index 708535f07b..e94a9f4af4 100644 --- a/exercises/point-mutations/README.md +++ b/exercises/point-mutations/README.md @@ -34,13 +34,12 @@ distance function. **Note: This problem is deprecated, replaced by the one called `hamming`.** -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/poker/README.md b/exercises/poker/README.md index b3eabf566a..d22f86e28b 100644 --- a/exercises/poker/README.md +++ b/exercises/poker/README.md @@ -5,13 +5,12 @@ Pick the best hand(s) from a list of poker hands. See [wikipedia](https://en.wikipedia.org/wiki/List_of_poker_hands) for an overview of poker hands. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/prime-factors/README.md b/exercises/prime-factors/README.md index 3f96cfcf8d..d625d41833 100644 --- a/exercises/prime-factors/README.md +++ b/exercises/prime-factors/README.md @@ -29,13 +29,12 @@ You can check this yourself: - = 60 - Success! -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/protein-translation/README.md b/exercises/protein-translation/README.md index 7fb98c7bf2..607ef842c8 100644 --- a/exercises/protein-translation/README.md +++ b/exercises/protein-translation/README.md @@ -10,17 +10,17 @@ Codons: `"AUG", "UUU", "UCU"` => which become a polypeptide with the following sequence => Protein: `"Methionine", "Phenylalanine", "Serine"` - + There are 64 codons which in turn correspond to 20 amino acids; however, all of the codon sequences and resulting amino acids are not important in this exercise. If it works for one codon, the program should work for all of them. -However, feel free to expand the list in the test suite to include them all. +However, feel free to expand the list in the test suite to include them all. -There are also four terminating codons (also known as 'STOP' codons); if any of these codons are encountered (by the ribosome), all translation ends and the protein is terminated. +There are also three terminating codons (also known as 'STOP' codons); if any of these codons are encountered (by the ribosome), all translation ends and the protein is terminated. All subsequent codons after are ignored, like this: RNA: `"AUGUUUUCUUAAAUG"` => -Codons: `"AUG", "UUU", "UCU", "UAG", "AUG"` => +Codons: `"AUG", "UUU", "UCU", "UAG", "AUG"` => Protein: `"Methionine", "Phenylalanine", "Serine"` @@ -39,16 +39,14 @@ UGU, UGC | Cysteine UGG | Tryptophan UAA, UAG, UGA | STOP - Learn more about [protein translation on Wikipedia](http://en.wikipedia.org/wiki/Translation_(biology)) -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/proverb/README.md b/exercises/proverb/README.md index 8e0ab29b6c..9ecbefa263 100644 --- a/exercises/proverb/README.md +++ b/exercises/proverb/README.md @@ -1,23 +1,24 @@ # Proverb -For want of a horseshoe nail, a kingdom was lost, or so the saying goes. Output -the full text of this proverbial rhyme: +For want of a horseshoe nail, a kingdom was lost, or so the saying goes. -> For want of a nail the shoe was lost. -> For want of a shoe the horse was lost. -> For want of a horse the rider was lost. -> For want of a rider the message was lost. -> For want of a message the battle was lost. -> For want of a battle the kingdom was lost. -> And all for the want of a horseshoe nail. +Output the full text of this proverbial rhyme: -### Submitting Exercises +```text +For want of a nail the shoe was lost. +For want of a shoe the horse was lost. +For want of a horse the rider was lost. +For want of a rider the message was lost. +For want of a message the battle was lost. +For want of a battle the kingdom was lost. +And all for the want of a horseshoe nail. +``` +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/pythagorean-triplet/README.md b/exercises/pythagorean-triplet/README.md index 40848efd6a..c48b0fbad7 100644 --- a/exercises/pythagorean-triplet/README.md +++ b/exercises/pythagorean-triplet/README.md @@ -3,13 +3,13 @@ A Pythagorean triplet is a set of three natural numbers, {a, b, c}, for which, -``` +```text a**2 + b**2 = c**2 ``` -For example, +For example, -``` +```text 3**2 + 4**2 = 9 + 16 = 25 = 5**2. ``` @@ -17,13 +17,12 @@ There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product a * b * c. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/queen-attack/README.md b/exercises/queen-attack/README.md index 95149394e5..1a6e94e975 100644 --- a/exercises/queen-attack/README.md +++ b/exercises/queen-attack/README.md @@ -11,7 +11,7 @@ A chessboard can be represented by an 8 by 8 array. So if you're told the white queen is at (2, 3) and the black queen at (5, 6), then you'd know you've got a set-up like so: -```plain +```text _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ W _ _ _ _ @@ -26,13 +26,12 @@ You'd also be able to answer whether the queens can attack each other. In this case, that answer would be yes, they can, because both pieces share a diagonal. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/rail-fence-cipher/README.md b/exercises/rail-fence-cipher/README.md index 1bcfb15274..7bdccff2d4 100644 --- a/exercises/rail-fence-cipher/README.md +++ b/exercises/rail-fence-cipher/README.md @@ -11,41 +11,46 @@ Finally the message is then read off in rows. For example, using three "rails" and the message "WE ARE DISCOVERED FLEE AT ONCE", the cipherer writes out: -``` + +```text W . . . E . . . C . . . R . . . L . . . T . . . E . E . R . D . S . O . E . E . F . E . A . O . C . . . A . . . I . . . V . . . D . . . E . . . N . . ``` Then reads off: -``` + +```text WECRLTEERDSOEEFEAOCAIVDEN ``` - To decrypt a message you take the zig-zag shape and fill the ciphertext along the rows. -``` + +```text ? . . . ? . . . ? . . . ? . . . ? . . . ? . . . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . . . ? . . . ? . . . ? . . . ? . . . ? . . . ? . . ``` The first row has seven spots that can be filled with "WECRLTE". -``` + +```text W . . . E . . . C . . . R . . . L . . . T . . . E . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . ? . . . ? . . . ? . . . ? . . . ? . . . ? . . . ? . . ``` Now the 2nd row takes "ERDSOEEFEAOC". -``` + +```text W . . . E . . . C . . . R . . . L . . . T . . . E . E . R . D . S . O . E . E . F . E . A . O . C . . . ? . . . ? . . . ? . . . ? . . . ? . . . ? . . ``` Leaving "AIVDEN" for the last row. -``` + +```text W . . . E . . . C . . . R . . . L . . . T . . . E . E . R . D . S . O . E . E . F . E . A . O . C . . . A . . . I . . . V . . . D . . . E . . . N . . @@ -53,13 +58,12 @@ W . . . E . . . C . . . R . . . L . . . T . . . E If you now read along the zig-zag shape you can read the original message. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/raindrops/README.md b/exercises/raindrops/README.md index 1889d6d5bd..1fa327b67b 100644 --- a/exercises/raindrops/README.md +++ b/exercises/raindrops/README.md @@ -17,13 +17,12 @@ Convert a number to a string, the contents of which depend on the number's facto - 34 has four factors: 1, 2, 17, and 34. - In raindrop-speak, this would be "34". -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/rectangles/README.md b/exercises/rectangles/README.md index c14c931721..75c549bbdb 100644 --- a/exercises/rectangles/README.md +++ b/exercises/rectangles/README.md @@ -2,7 +2,7 @@ Count the rectangles in an ASCII diagram like the one below. -``` +```text +--+ ++ | +-++--+ @@ -12,7 +12,7 @@ Count the rectangles in an ASCII diagram like the one below. The above diagram contains 6 rectangles: -``` +```text +-----+ @@ -20,7 +20,7 @@ The above diagram contains 6 rectangles: +-----+ ``` -``` +```text +--+ | | | | @@ -28,7 +28,7 @@ The above diagram contains 6 rectangles: +--+ ``` -``` +```text +--+ | | +--+ @@ -36,7 +36,7 @@ The above diagram contains 6 rectangles: ``` -``` +```text +--+ @@ -44,7 +44,7 @@ The above diagram contains 6 rectangles: +--+ ``` -``` +```text +--+ @@ -52,7 +52,7 @@ The above diagram contains 6 rectangles: +--+ ``` -``` +```text ++ ++ @@ -63,13 +63,12 @@ The above diagram contains 6 rectangles: You may assume that the input is always a proper rectangle (i.e. the length of every line equals the length of the first line). -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/rna-transcription/README.md b/exercises/rna-transcription/README.md index 394d480e3b..8be5c1e756 100644 --- a/exercises/rna-transcription/README.md +++ b/exercises/rna-transcription/README.md @@ -18,13 +18,12 @@ each nucleotide with its complement: * `T` -> `A` * `A` -> `U` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/robot-name/README.md b/exercises/robot-name/README.md index 726b3505ab..a28ed95e20 100644 --- a/exercises/robot-name/README.md +++ b/exercises/robot-name/README.md @@ -15,13 +15,12 @@ The names must be random: they should not follow a predictable sequence. Random names means a risk of collisions. Your solution must ensure that every existing robot has a unique name. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/robot-simulator/README.md b/exercises/robot-simulator/README.md index 5929629fb2..cc696556ac 100644 --- a/exercises/robot-simulator/README.md +++ b/exercises/robot-simulator/README.md @@ -27,13 +27,12 @@ direction it is pointing. - Say a robot starts at {7, 3} facing north. Then running this stream of instructions should leave it at {9, 4} facing west. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/roman-numerals/README.md b/exercises/roman-numerals/README.md index c0a3e14a68..3ce7b49432 100644 --- a/exercises/roman-numerals/README.md +++ b/exercises/roman-numerals/README.md @@ -14,7 +14,7 @@ The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice these letters have lots of straight lines and are hence easy to hack into stone tablets). -``` +```text 1 => I 10 => X 7 => VII @@ -42,13 +42,12 @@ In Roman numerals 1990 is MCMXC: See also: http://www.novaroma.org/via_romana/numbers.html -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/rotational-cipher/README.md b/exercises/rotational-cipher/README.md index da021c7114..0dc9438251 100644 --- a/exercises/rotational-cipher/README.md +++ b/exercises/rotational-cipher/README.md @@ -13,7 +13,7 @@ The most commonly used rotational cipher is `ROT13`. A `ROT13` on the Latin alphabet would be as follows: -```plain +```text Plain: abcdefghijklmnopqrstuvwxyz Cipher: nopqrstuvwxyzabcdefghijklm ``` @@ -23,19 +23,19 @@ It is stronger than the Atbash cipher because it has 27 possible keys, and 25 us Ciphertext is written out in the same formatting as the input including spaces and punctuation. ## Examples + - ROT5 `omg` gives `trl` - ROT0 `c` gives `c` - ROT26 `Cool` gives `Cool` - ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` - ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/run-length-encoding/README.md b/exercises/run-length-encoding/README.md index c3c63889af..da8623afe9 100644 --- a/exercises/run-length-encoding/README.md +++ b/exercises/run-length-encoding/README.md @@ -7,29 +7,28 @@ Run-length encoding (RLE) is a simple form of data compression, where runs For example we can represent the original 53 characters with only 13. -``` +```text "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB" ``` RLE allows the original data to be perfectly reconstructed from the compressed data, which makes it a lossless data compression. -``` +```text "AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE" ``` For simplicity, you can assume that the unencoded string will only contain -the letters A through Z (either lower or upper case) and whitespace. This way -data to be encoded will never contain any numbers and numbers inside data to +the letters A through Z (either lower or upper case) and whitespace. This way +data to be encoded will never contain any numbers and numbers inside data to be decoded always represent the count for the following character. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/saddle-points/README.md b/exercises/saddle-points/README.md index 7f93304636..b8602a77c2 100644 --- a/exercises/saddle-points/README.md +++ b/exercises/saddle-points/README.md @@ -4,7 +4,7 @@ Detect saddle points in a matrix. So say you have a matrix like so: -```plain +```text 0 1 2 |--------- 0 | 9 8 7 @@ -26,13 +26,12 @@ saddle points for any given matrix. Note that you may find other definitions of matrix saddle points online, but the tests for this exercise follow the above unambiguous definition. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/say/README.md b/exercises/say/README.md index 3ff585d749..8e975b8c15 100644 --- a/exercises/say/README.md +++ b/exercises/say/README.md @@ -62,13 +62,12 @@ Use _and_ (correctly) when spelling out the number in English: - 1002 becomes "one thousand and two". - 1323 becomes "one thousand three hundred and twenty-three". -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/scale-generator/README.md b/exercises/scale-generator/README.md index 5d24264a0b..714e9ba7b9 100644 --- a/exercises/scale-generator/README.md +++ b/exercises/scale-generator/README.md @@ -32,7 +32,6 @@ Use Flats: F, Bb, Eb, Ab, Db, Gb major d, g, c, f, bb, eb minor - The diatonic scales, and all other scales that derive from the chromatic scale, are built upon intervals. An interval is the space between two pitches. @@ -56,13 +55,12 @@ Here is a table of pitches with the names of their interval distance from the to | | | Dim 3rd | Aug 2nd | Dim 4th | | Aug 4th | Dim 5th | Aug 5th | Dim 7th | Aug 6th | Dim 8ve | | | | | | | | | Dim 5th | | | | | | | -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/scrabble-score/README.md b/exercises/scrabble-score/README.md index 5700c091ed..6886008da7 100644 --- a/exercises/scrabble-score/README.md +++ b/exercises/scrabble-score/README.md @@ -6,7 +6,7 @@ Given a word, compute the scrabble score for that word. You'll need these: -```plain +```text Letter Value A, E, I, O, U, L, N, R, S, T 1 D, G 2 @@ -18,6 +18,7 @@ Q, Z 10 ``` ## Examples + "cabbage" should be scored as worth 14 points: - 3 points for C @@ -34,16 +35,16 @@ And to total: - = 14 ## Extensions + - You can play a double or a triple letter. - You can play a double or a triple word. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/secret-handshake/README.md b/exercises/secret-handshake/README.md index 70e9fa984f..f596df0320 100644 --- a/exercises/secret-handshake/README.md +++ b/exercises/secret-handshake/README.md @@ -6,7 +6,7 @@ You and your fellow cohort of those in the "know" when it comes to binary decide to come up with a secret "handshake". -``` +```text 1 = wink 10 = double blink 100 = close your eyes @@ -28,13 +28,12 @@ Given the input 19, the function would return the array Notice that the addition of 16 (10000 in binary) has caused the array to be reversed. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/series/README.md b/exercises/series/README.md index ae1f2706f6..be07e13e4f 100644 --- a/exercises/series/README.md +++ b/exercises/series/README.md @@ -20,13 +20,12 @@ whatever you get. Note that these series are only required to occupy *adjacent positions* in the input; the digits need not be *numerically consecutive*. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/sieve/README.md b/exercises/sieve/README.md index 6ba103b5d6..4bcec38a12 100644 --- a/exercises/sieve/README.md +++ b/exercises/sieve/README.md @@ -27,13 +27,12 @@ Notice that this is a very specific algorithm, and the tests don't check that you've implemented the algorithm, only that you've come up with the correct list of primes. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/simple-cipher/README.md b/exercises/simple-cipher/README.md index d271150fa4..594be46558 100644 --- a/exercises/simple-cipher/README.md +++ b/exercises/simple-cipher/README.md @@ -47,7 +47,7 @@ Given the key "aaaaaaaaaaaaaaaaaa", encoding the string "iamapandabear" would return the original "iamapandabear". Given the key "ddddddddddddddddd", encoding our string "iamapandabear" -would return the obscured "lpdsdqgdehdu" +would return the obscured "ldpdsdqgdehdu" In the example above, we've set a = 0 for the key value. So when the plaintext is added to the key, we end up with the same message coming @@ -65,7 +65,7 @@ If someone doesn't submit a key at all, generate a truly random key of at least 100 characters in length, accessible via Cipher#key (the # syntax means instance variable) -If the key submitted has capital letters or numbers, throw an +If the key submitted has capital letters or numbers, throw a ValueError with a message to that effect. ## Extensions @@ -100,13 +100,12 @@ cryptographically strong random numbers that provide the greater security requir Since this is only an exercise, `random` is fine to use, but note that **it would be very insecure if actually used for cryptography.** -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/space-age/README.md b/exercises/space-age/README.md index 00ab3d5799..2cde9fa289 100644 --- a/exercises/space-age/README.md +++ b/exercises/space-age/README.md @@ -12,18 +12,17 @@ Given an age in seconds, calculate how old someone would be on: - Neptune: orbital period 164.79132 Earth years So if you were told someone were 1,000,000,000 seconds old, you should -be able to say that they're 31 Earth-years old. +be able to say that they're 31.69 Earth-years old. If you're wondering why Pluto didn't make the cut, go watch [this youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs). -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/strain/README.md b/exercises/strain/README.md index 03b2996580..d2d5cab22c 100644 --- a/exercises/strain/README.md +++ b/exercises/strain/README.md @@ -33,13 +33,12 @@ Keep your hands off that filter/reject/whatchamacallit functionality provided by your standard library! Solve this one yourself using other basic tools instead. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/sublist/README.md b/exercises/sublist/README.md index 82b5643b81..5686e5c622 100644 --- a/exercises/sublist/README.md +++ b/exercises/sublist/README.md @@ -17,13 +17,12 @@ Examples: * A = [1, 2, 3, 4, 5], B = [2, 3, 4], A is a superlist of B * A = [1, 2, 4], B = [1, 2, 3, 4, 5], A is not a superlist of, sublist of or equal to B -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/sum-of-multiples/README.md b/exercises/sum-of-multiples/README.md index 771c403d78..6434de1705 100644 --- a/exercises/sum-of-multiples/README.md +++ b/exercises/sum-of-multiples/README.md @@ -8,16 +8,12 @@ multiples of either 3 or 5, we get 3, 5, 6 and 9, 10, 12, 15, and 18. The sum of these multiples is 78. -Given a number, find the sum of the multiples of a given set of numbers, -up to but not including that number. - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/tournament/README.md b/exercises/tournament/README.md index bc99ee000b..2a742e8bb7 100644 --- a/exercises/tournament/README.md +++ b/exercises/tournament/README.md @@ -5,7 +5,7 @@ Tally the results of a small football competition. Based on an input file containing which team played against which and what the outcome was, create a file with a table like this: -``` +```text Team | MP | W | D | L | P Devastating Donkeys | 3 | 2 | 1 | 0 | 7 Allegoric Alaskans | 3 | 2 | 0 | 1 | 6 @@ -31,7 +31,7 @@ Input Your tallying program will receive input that looks like: -``` +```text Allegoric Alaskans;Blithering Badgers;win Devastating Donkeys;Courageous Californians;draw Devastating Donkeys;Allegoric Alaskans;win @@ -42,7 +42,7 @@ Allegoric Alaskans;Courageous Californians;win The result of the match refers to the first team listed. So this line -``` +```text Allegoric Alaskans;Blithering Badgers;win ``` @@ -50,7 +50,7 @@ Means that the Allegoric Alaskans beat the Blithering Badgers. This line: -``` +```text Courageous Californians;Blithering Badgers;loss ``` @@ -58,19 +58,18 @@ Means that the Blithering Badgers beat the Courageous Californians. And this line: -``` +```text Devastating Donkeys;Courageous Californians;draw ``` Means that the Devastating Donkeys and Courageous Californians tied. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/transpose/README.md b/exercises/transpose/README.md index b601fa3d22..b3e90971af 100644 --- a/exercises/transpose/README.md +++ b/exercises/transpose/README.md @@ -4,14 +4,14 @@ Given an input text output it transposed. Roughly explained, the transpose of a matrix: -``` +```text ABC DEF ``` is given by: -``` +```text AD BE CF @@ -26,14 +26,14 @@ If the input has rows of different lengths, this is to be solved as follows: Therefore, transposing this matrix: -``` +```text ABC DE ``` results in: -``` +```text AD BE C @@ -41,30 +41,29 @@ C And transposing: -``` +```text AB DEF ``` results in: -``` +```text AD BE F ``` In general, all characters from the input should also be present in the transposed output. -That means that if a column in the input text contains only spaces on its bottom-most row(s), +That means that if a column in the input text contains only spaces on its bottom-most row(s), the corresponding output row should contain the spaces in its right-most column(s). -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/triangle/README.md b/exercises/triangle/README.md index 5db27a38eb..7b62964890 100644 --- a/exercises/triangle/README.md +++ b/exercises/triangle/README.md @@ -2,30 +2,32 @@ Determine if a triangle is equilateral, isosceles, or scalene. -An _equilateral_ triangle has all three sides the same length.
+An _equilateral_ triangle has all three sides the same length. + An _isosceles_ triangle has at least two sides the same length. (It is sometimes specified as having exactly two sides the same length, but for the purposes of -this exercise we'll say at least two.)
+this exercise we'll say at least two.) + A _scalene_ triangle has all sides of different lengths. ## Note -For a shape to be a triangle at all, all sides have to be of length > 0, and -the sum of the lengths of any two sides must be greater than or equal to the +For a shape to be a triangle at all, all sides have to be of length > 0, and +the sum of the lengths of any two sides must be greater than or equal to the length of the third side. See [Triangle Inequality](https://en.wikipedia.org/wiki/Triangle_inequality). ## Dig Deeper -The case where the sum of the lengths of two sides _equals_ that of the -third is known as a _degenerate_ triangle - it has zero area and looks like +The case where the sum of the lengths of two sides _equals_ that of the +third is known as a _degenerate_ triangle - it has zero area and looks like a single line. Feel free to add your own code/tests to check for degenerate triangles. -### Submitting Exercises + +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/trinary/README.md b/exercises/trinary/README.md index 8e2d556cd7..fa75e47a6b 100644 --- a/exercises/trinary/README.md +++ b/exercises/trinary/README.md @@ -11,7 +11,7 @@ Trinary numbers contain three symbols: 0, 1, and 2. The last place in a trinary number is the 1's place. The second to last is the 3's place, the third to last is the 9's place, etc. -```bash +```shell # "102012" 1 0 2 0 1 2 # the number 1*3^5 + 0*3^4 + 2*3^3 + 0*3^2 + 1*3^1 + 2*3^0 # the value @@ -21,13 +21,12 @@ is the 3's place, the third to last is the 9's place, etc. If your language provides a method in the standard library to perform the conversion, pretend it doesn't exist and implement it yourself. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/twelve-days/README.md b/exercises/twelve-days/README.md index acbc7e6d85..f121441592 100644 --- a/exercises/twelve-days/README.md +++ b/exercises/twelve-days/README.md @@ -2,7 +2,7 @@ Output the lyrics to 'The Twelve Days of Christmas'. -``` +```text On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree. On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree. @@ -28,13 +28,12 @@ On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree. ``` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/two-bucket/README.md b/exercises/two-bucket/README.md index 32fb88da5a..1faf655299 100644 --- a/exercises/two-bucket/README.md +++ b/exercises/two-bucket/README.md @@ -4,7 +4,7 @@ Given two buckets of different size, demonstrate how to measure an exact number Since this mathematical problem is fairly subject to interpretation / individual approach, the tests have been written specifically to expect one overarching solution. -To help, the tests provide you with which bucket to fill first. That means, when starting with the larger bucket full, you are NOT allowed at any point to have the smaller bucket full and the larger bucket empty (aka, the opposite starting point); that would defeat the purpose of comparing both approaches! +To help, the tests provide you with which bucket to fill first. That means, when starting with the larger bucket full, you are NOT allowed at any point to have the smaller bucket full and the larger bucket empty (aka, the opposite starting point); that would defeat the purpose of comparing both approaches! Your program will take as input: - the size of bucket one, passed as a numeric value @@ -17,9 +17,9 @@ Your program should determine: - which bucket should end up with the desired number of liters (let's say this is bucket A) - expects a String (either 'one' or 'two') - how many liters are left in the other bucket (bucket B) - expects a numeric value -Note: any time a change is made to either or both buckets counts as one (1) move. +Note: any time a change is made to either or both buckets counts as one (1) move. -Example: +Example: Bucket one can hold up to 7 liters, and bucket two can hold up to 11 liters. Let's say bucket one, at a given step, is holding 7 liters, and bucket two is holding 8 liters (7,8). If you empty bucket one and make no change to bucket two, leaving you with 0 liters and 8 liters respectively (0,8), that counts as one "move". Instead, if you had poured from bucket one into bucket two until bucket two was full, leaving you with 4 liters in bucket one and 11 liters in bucket two (4,11), that would count as only one "move" as well. To conclude, the only valid moves are: @@ -29,13 +29,12 @@ To conclude, the only valid moves are: Written with <3 at [Fullstack Academy](http://www.fullstackacademy.com/) by [Lindsay](http://lindsaylevine.com). -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/two-fer/README.md b/exercises/two-fer/README.md index 22d56648d6..a3e3cc0126 100644 --- a/exercises/two-fer/README.md +++ b/exercises/two-fer/README.md @@ -1,8 +1,8 @@ -# Two-fer +# Two Fer `Two-fer` or `2-fer` is short for two for one. One for you and one for me. -``` +```text "One for X, one for me." ``` @@ -11,13 +11,12 @@ When X is a name or "you". If the given name is "Alice", the result should be "One for Alice, one for me." If no name is given, the result should be "One for you, one for me." -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). @@ -26,4 +25,4 @@ please see the [help page](http://exercism.io/languages/python). This is an exercise to introduce users to basic programming constructs, just after hello World. [https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer) ## Submitting Incomplete Solutions -It's possible to submit an incomplete solution so you can see how others have completed the exercise. \ No newline at end of file +It's possible to submit an incomplete solution so you can see how others have completed the exercise. diff --git a/exercises/variable-length-quantity/README.md b/exercises/variable-length-quantity/README.md index 0c879761ba..de56c5f39b 100644 --- a/exercises/variable-length-quantity/README.md +++ b/exercises/variable-length-quantity/README.md @@ -5,18 +5,17 @@ Implement variable length quantity encoding and decoding. The goal of this exercise is to implement [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) encoding/decoding. In short, the goal of this encoding is to encode integer values in a way that would save bytes. -Only the first 7 bits of each byte is significant (right-justified; sort of like an ASCII byte). -So, if you have a 32-bit value, you have to unpack it into a series of 7-bit bytes. -Of course, you will have a variable number of bytes depending upon your integer. +Only the first 7 bits of each byte is significant (right-justified; sort of like an ASCII byte). +So, if you have a 32-bit value, you have to unpack it into a series of 7-bit bytes. +Of course, you will have a variable number of bytes depending upon your integer. To indicate which is the last byte of the series, you leave bit #7 clear. -In all of the preceding bytes, you set bit #7. +In all of the preceding bytes, you set bit #7. -So, if an integer is between `0-127`, it can be represented as one byte. +So, if an integer is between `0-127`, it can be represented as one byte. Although VLQ can deal with numbers of arbitrary sizes, for this exercise we will restrict ourselves to only numbers that fit in a 32-bit unsigned integer. Here are examples of integers as 32-bit values, and the variable length quantities that they translate to: - -``` +```text NUMBER VARIABLE QUANTITY 00000000 00 00000040 40 @@ -32,13 +31,12 @@ Here are examples of integers as 32-bit values, and the variable length quantiti 0FFFFFFF FF FF FF 7F ``` -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/word-count/README.md b/exercises/word-count/README.md index dd41aef715..bbf9c783ff 100644 --- a/exercises/word-count/README.md +++ b/exercises/word-count/README.md @@ -4,21 +4,19 @@ Given a phrase, count the occurrences of each word in that phrase. For example for the input `"olly olly in come free"` -```plain +```text olly: 2 in: 1 come: 1 free: 1 ``` - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/word-search/README.md b/exercises/word-search/README.md index 8f5317387a..726b977b82 100644 --- a/exercises/word-search/README.md +++ b/exercises/word-search/README.md @@ -5,7 +5,7 @@ words in them. For example: -``` +```text jefblpepre camdcimgtc oivokprjsm @@ -26,13 +26,12 @@ vertical and diagonal. Given a puzzle and a list of words return the location of the first and last letter of each word. -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/wordy/README.md b/exercises/wordy/README.md index f3c7112cc8..c4c00c6620 100644 --- a/exercises/wordy/README.md +++ b/exercises/wordy/README.md @@ -2,7 +2,6 @@ Parse and evaluate simple math word problems returning the answer as an integer. - ## Iteration 1 — Addition Add two numbers together. @@ -13,7 +12,6 @@ Evaluates to 18. Handle large numbers and negative numbers. - ## Iteration 2 — Subtraction, Multiplication and Division Now, perform the other three operations. @@ -30,7 +28,6 @@ Now, perform the other three operations. 5 - ## Iteration 3 — Multiple Operations Handle a set of operations, in sequence. @@ -46,7 +43,6 @@ left-to-right, _ignoring the typical order of operations._ 15 (i.e. not 9) - ## Bonus — Exponentials If you'd like, handle exponentials. @@ -55,14 +51,12 @@ If you'd like, handle exponentials. 32 - -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python). diff --git a/exercises/zebra-puzzle/README.md b/exercises/zebra-puzzle/README.md index 82a592a577..e47107dc1a 100644 --- a/exercises/zebra-puzzle/README.md +++ b/exercises/zebra-puzzle/README.md @@ -25,13 +25,12 @@ drink different beverages and smoke different brands of cigarettes. Which of the residents drinks water? Who owns the zebra? -### Submitting Exercises +## Submitting Exercises Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. - For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/python).