Update and reformat all READMEs (#950)

* Move 'Submitting Exercises' to heading level 2

* Regenerate READMEs using configlet

* diffie-hellman: add hints.md and regenerate README

* collatz-conjecture: add hints.md and regenerate README

* simple-cipher: suggest returning a ValueError

* two-fer: Remove Test-Driven Development section
This commit is contained in:
Nathan Parsons
2017-10-25 22:04:48 +01:00
committed by GitHub
parent 705a4d384f
commit cf4f50f4dc
98 changed files with 368 additions and 453 deletions

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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.

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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.

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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
```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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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)

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -10,14 +10,12 @@ 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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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.

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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.

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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:
<pre>
```text
hello
world
hello again
</pre>
```
If we were to call `grep "hello" input.txt`, the returned string should be:
<pre>
```text
hello
hello again
</pre>
```
### 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:
<pre>
```text
1:hello
3:hello again
</pre>
```
And if we run `grep -i "HELLO" input.txt`, we'll do a case-insensitive match,
and the output will be:
<pre>
```text
hello
hello again
</pre>
```
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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -27,13 +27,12 @@ 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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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.

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -22,14 +22,12 @@ Given examples of a meetup dates, each containing a month, day, year, and descri
(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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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
- nucleotides are to DNA as
- legos are to lego houses as
- words are to sentences as...
I'm not going to talk about lipids because they're crazy complex.
So back to nucleotides.
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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -8,13 +8,12 @@ The best known English pangram is:
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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -17,13 +17,12 @@ The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) d
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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -17,13 +17,12 @@ variants too.
See <http://en.wikipedia.org/wiki/Pig_latin> for more details.
### Submitting Exercises
## Submitting Exercises
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -14,7 +14,7 @@ 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.
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:
@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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,
```
```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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -7,14 +7,14 @@ 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"
```
@@ -23,13 +23,12 @@ 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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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,14 +41,14 @@ C
And transposing:
```
```text
AB
DEF
```
results in:
```
```text
AD
BE
F
@@ -58,13 +58,12 @@ In general, all characters from the input should also be present in the transpos
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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -2,10 +2,12 @@
Determine if a triangle is equilateral, isosceles, or scalene.
An _equilateral_ triangle has all three sides the same length.<br/>
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.)<br/>
this exercise we'll say at least two.)
A _scalene_ triangle has all sides of different lengths.
## Note
@@ -19,13 +21,13 @@ length of the third side. See [Triangle Inequality](https://en.wikipedia.org/wik
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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -15,8 +15,7 @@ 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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).

View File

@@ -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/<exerciseName>` directory.
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/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).