trackler 2.2.1.53 → 2.2.1.54
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/nth-prime/canonical-data.json +2 -7
- data/problem-specifications/exercises/zebra-puzzle/canonical-data.json +16 -0
- data/tracks/c/config.json +11 -1
- data/tracks/c/docs/C_STYLE_GUIDE.md +142 -0
- data/tracks/c/exercises/collatz-conjecture/README.md +65 -0
- data/tracks/c/exercises/collatz-conjecture/makefile +15 -0
- data/tracks/c/exercises/collatz-conjecture/src/collatz_conjecture.h +8 -0
- data/tracks/c/exercises/collatz-conjecture/src/example.c +23 -0
- data/tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c +48 -0
- data/tracks/c/exercises/collatz-conjecture/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/collatz-conjecture/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/collatz-conjecture/test/vendor/unity_internals.h +701 -0
- data/tracks/cfml/tasks/GenerateReadme.cfc +5 -5
- data/tracks/erlang/testgen/src/testgen.erl +99 -17
- data/tracks/erlang/testgen/src/tg_file_tools.erl +3 -3
- data/tracks/erlang/testgen/src/tgen.erl +15 -7
- data/tracks/haskell/config.json +15 -3
- data/tracks/java/scripts/canonical_data_check.sh +1 -1
- data/tracks/javascript/config.json +12 -0
- data/tracks/javascript/exercises/difference-of-squares/README.md +1 -1
- data/tracks/javascript/exercises/sum-of-multiples/README.md +1 -1
- data/tracks/javascript/exercises/zipper/README.md +55 -0
- data/tracks/javascript/exercises/zipper/example.js +100 -0
- data/tracks/javascript/exercises/zipper/zipper.spec.js +77 -0
- data/tracks/julia/config.json +12 -0
- data/tracks/julia/exercises/triangle/README.md +30 -0
- data/tracks/julia/exercises/triangle/example.jl +25 -0
- data/tracks/julia/exercises/triangle/runtests.jl +64 -0
- data/tracks/julia/exercises/triangle/triangle.jl +8 -0
- data/tracks/kotlin/exercises/leap/.meta/version +1 -1
- data/tracks/kotlin/exercises/leap/src/test/kotlin/LeapTest.kt +1 -1
- data/tracks/kotlin/scripts/canonical_data_check.sh +1 -1
- data/tracks/perl6/bin/README.md +1 -4
- data/tracks/perl6/bin/exercise-gen.pl6 +3 -4
- data/tracks/perl6/exercises/accumulate/example.yaml +2 -2
- data/tracks/perl6/exercises/all-your-base/example.yaml +9 -9
- data/tracks/perl6/exercises/allergies/example.yaml +7 -7
- data/tracks/perl6/exercises/anagram/example.yaml +3 -3
- data/tracks/perl6/exercises/atbash-cipher/example.yaml +3 -3
- data/tracks/perl6/exercises/bob/example.yaml +4 -4
- data/tracks/perl6/exercises/clock/example.yaml +6 -6
- data/tracks/perl6/exercises/flatten-array/example.yaml +4 -4
- data/tracks/perl6/exercises/grade-school/example.yaml +6 -6
- data/tracks/perl6/exercises/grains/example.yaml +3 -3
- data/tracks/perl6/exercises/hello-world/example.yaml +5 -5
- data/tracks/perl6/exercises/leap/example.yaml +4 -4
- data/tracks/perl6/exercises/linked-list/example.yaml +14 -14
- data/tracks/perl6/exercises/luhn/example.yaml +3 -3
- data/tracks/perl6/exercises/phone-number/example.yaml +3 -3
- data/tracks/perl6/exercises/raindrops/example.yaml +3 -3
- data/tracks/perl6/exercises/rna-transcription/example.yaml +3 -3
- data/tracks/perl6/exercises/robot-name/example.yaml +8 -8
- data/tracks/perl6/exercises/scrabble-score/example.yaml +3 -3
- data/tracks/perl6/exercises/space-age/example.yaml +8 -8
- data/tracks/perl6/exercises/word-count/example.yaml +3 -3
- data/tracks/perl6/exercises/wordy/example.yaml +3 -3
- data/tracks/python/config.json +14 -0
- data/tracks/python/config/maintainers.json +30 -0
- data/tracks/python/docs/EXERCISE_README_INSERT.md +1 -2
- data/tracks/python/exercises/accumulate/README.md +1 -5
- data/tracks/python/exercises/acronym/README.md +1 -3
- data/tracks/python/exercises/all-your-base/README.md +2 -3
- data/tracks/python/exercises/all-your-base/all_your_base_test.py +13 -13
- data/tracks/python/exercises/allergies/README.md +1 -3
- data/tracks/python/exercises/alphametics/README.md +3 -4
- data/tracks/python/exercises/anagram/README.md +1 -2
- data/tracks/python/exercises/atbash-cipher/README.md +3 -3
- data/tracks/python/exercises/beer-song/README.md +2 -3
- data/tracks/python/exercises/binary-search/README.md +1 -2
- data/tracks/python/exercises/binary/README.md +3 -2
- data/tracks/python/exercises/bob/README.md +1 -2
- data/tracks/python/exercises/book-store/README.md +6 -7
- data/tracks/python/exercises/bracket-push/README.md +1 -2
- data/tracks/python/exercises/change/README.md +2 -3
- data/tracks/python/exercises/circular-buffer/README.md +14 -8
- data/tracks/python/exercises/clock/README.md +1 -2
- data/tracks/python/exercises/clock/clock_test.py +2 -0
- data/tracks/python/exercises/collatz-conjecture/.meta/hints.md +3 -0
- data/tracks/python/exercises/collatz-conjecture/README.md +6 -19
- data/tracks/python/exercises/complex-numbers/README.md +28 -2
- data/tracks/python/exercises/crypto-square/README.md +11 -10
- data/tracks/python/exercises/diamond/README.md +7 -8
- data/tracks/python/exercises/difference-of-squares/README.md +1 -2
- data/tracks/python/exercises/diffie-hellman/.meta/hints.md +1 -1
- data/tracks/python/exercises/diffie-hellman/README.md +3 -2
- data/tracks/python/exercises/error-handling/.meta/hints.md +8 -0
- data/tracks/python/exercises/error-handling/README.md +10 -2
- data/tracks/python/exercises/error-handling/error_handling_test.py +15 -3
- data/tracks/python/exercises/etl/README.md +3 -2
- data/tracks/python/exercises/flatten-array/README.md +2 -4
- data/tracks/python/exercises/food-chain/README.md +3 -4
- data/tracks/python/exercises/forth/README.md +2 -6
- data/tracks/python/exercises/gigasecond/README.md +1 -2
- data/tracks/python/exercises/grade-school/README.md +1 -3
- data/tracks/python/exercises/grains/README.md +1 -3
- data/tracks/python/exercises/grep/README.md +13 -14
- data/tracks/python/exercises/hamming/README.md +1 -2
- data/tracks/python/exercises/hamming/hamming_test.py +6 -6
- data/tracks/python/exercises/hello-world/README.md +1 -2
- data/tracks/python/exercises/hexadecimal/README.md +1 -2
- data/tracks/python/exercises/hexadecimal/example.py +6 -6
- data/tracks/python/exercises/house/README.md +2 -4
- data/tracks/python/exercises/isogram/README.md +3 -3
- data/tracks/python/exercises/kindergarten-garden/README.md +14 -15
- data/tracks/python/exercises/largest-series-product/README.md +1 -2
- data/tracks/python/exercises/leap/README.md +2 -3
- data/tracks/python/exercises/linked-list/README.md +11 -12
- data/tracks/python/exercises/list-ops/README.md +1 -2
- data/tracks/python/exercises/luhn/README.md +8 -9
- data/tracks/python/exercises/markdown/README.md +1 -6
- data/tracks/python/exercises/matrix/README.md +7 -6
- data/tracks/python/exercises/meetup/README.md +2 -4
- data/tracks/python/exercises/minesweeper/README.md +1 -2
- data/tracks/python/exercises/nth-prime/README.md +1 -2
- data/tracks/python/exercises/nucleotide-count/README.md +9 -24
- data/tracks/python/exercises/ocr-numbers/README.md +6 -7
- data/tracks/python/exercises/octal/README.md +7 -4
- data/tracks/python/exercises/palindrome-products/README.md +16 -18
- data/tracks/python/exercises/pangram/README.md +2 -3
- data/tracks/python/exercises/pascals-triangle/README.md +2 -3
- data/tracks/python/exercises/perfect-numbers/README.md +3 -4
- data/tracks/python/exercises/phone-number/README.md +4 -4
- data/tracks/python/exercises/pig-latin/README.md +1 -2
- data/tracks/python/exercises/point-mutations/README.md +1 -2
- data/tracks/python/exercises/poker/README.md +1 -2
- data/tracks/python/exercises/prime-factors/README.md +1 -2
- data/tracks/python/exercises/protein-translation/README.md +5 -7
- data/tracks/python/exercises/proverb/README.md +12 -11
- data/tracks/python/exercises/pythagorean-triplet/README.md +4 -5
- data/tracks/python/exercises/queen-attack/README.md +2 -3
- data/tracks/python/exercises/rail-fence-cipher/README.md +13 -9
- data/tracks/python/exercises/raindrops/README.md +1 -2
- data/tracks/python/exercises/rectangles/README.md +8 -9
- data/tracks/python/exercises/rectangles/example.py +3 -3
- data/tracks/python/exercises/rna-transcription/README.md +1 -2
- data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +4 -3
- data/tracks/python/exercises/robot-name/README.md +1 -2
- data/tracks/python/exercises/robot-simulator/README.md +1 -2
- data/tracks/python/exercises/roman-numerals/README.md +2 -3
- data/tracks/python/exercises/rotational-cipher/README.md +3 -3
- data/tracks/python/exercises/run-length-encoding/README.md +5 -6
- data/tracks/python/exercises/run-length-encoding/example.py +2 -2
- data/tracks/python/exercises/saddle-points/README.md +2 -3
- data/tracks/python/exercises/say/README.md +1 -2
- data/tracks/python/exercises/scale-generator/README.md +1 -3
- data/tracks/python/exercises/scrabble-score/README.md +4 -3
- data/tracks/python/exercises/secret-handshake/README.md +2 -3
- data/tracks/python/exercises/series/README.md +1 -2
- data/tracks/python/exercises/sieve/README.md +1 -2
- data/tracks/python/exercises/simple-cipher/README.md +3 -4
- data/tracks/python/exercises/space-age/README.md +2 -3
- data/tracks/python/exercises/space-age/space_age_test.py +18 -29
- data/tracks/python/exercises/strain/README.md +1 -2
- data/tracks/python/exercises/sublist/README.md +1 -2
- data/tracks/python/exercises/sum-of-multiples/README.md +1 -5
- data/tracks/python/exercises/tournament/README.md +6 -7
- data/tracks/python/exercises/transpose/README.md +8 -9
- data/tracks/python/exercises/tree-building/README.md +25 -0
- data/tracks/python/exercises/tree-building/example.py +46 -0
- data/tracks/python/exercises/tree-building/tree_building.py +50 -0
- data/tracks/python/exercises/tree-building/tree_building_test.py +183 -0
- data/tracks/python/exercises/triangle/README.md +10 -8
- data/tracks/python/exercises/trinary/README.md +2 -3
- data/tracks/python/exercises/twelve-days/README.md +2 -3
- data/tracks/python/exercises/two-bucket/README.md +4 -5
- data/tracks/python/exercises/two-bucket/two_bucket_test.py +2 -0
- data/tracks/python/exercises/two-fer/README.md +4 -5
- data/tracks/python/exercises/two-fer/two_fer_test.py +5 -2
- data/tracks/python/exercises/variable-length-quantity/README.md +7 -9
- data/tracks/python/exercises/word-count/README.md +2 -4
- data/tracks/python/exercises/word-search/README.md +2 -3
- data/tracks/python/exercises/wordy/README.md +1 -7
- data/tracks/python/exercises/wordy/example.py +8 -8
- data/tracks/python/exercises/wordy/wordy_test.py +36 -32
- data/tracks/python/exercises/zebra-puzzle/README.md +1 -2
- data/tracks/python/requirements-travis.txt +1 -1
- data/tracks/ruby/config.json +11 -0
- data/tracks/ruby/docs/TESTS.md +6 -0
- data/tracks/ruby/exercises/pangram/.meta/.version +1 -1
- data/tracks/ruby/exercises/pangram/.meta/solutions/pangram.rb +1 -1
- data/tracks/ruby/exercises/pangram/pangram_test.rb +11 -4
- data/tracks/ruby/exercises/two-fer/.meta/.version +1 -0
- data/tracks/ruby/exercises/two-fer/.meta/generator/two_fer_case.rb +12 -0
- data/tracks/ruby/exercises/two-fer/.meta/solutions/two_fer.rb +9 -0
- data/tracks/ruby/exercises/two-fer/README.md +69 -0
- data/tracks/ruby/exercises/two-fer/two_fer_test.rb +42 -0
- data/tracks/rust/config.json +12 -0
- data/tracks/rust/exercises/binary-search/.meta/hints.md +38 -0
- data/tracks/rust/exercises/binary-search/Cargo.lock +4 -0
- data/tracks/rust/exercises/binary-search/Cargo.toml +6 -0
- data/tracks/rust/exercises/binary-search/README.md +113 -0
- data/tracks/rust/exercises/binary-search/example.rs +29 -0
- data/tracks/rust/exercises/binary-search/src/lib.rs +0 -0
- data/tracks/rust/exercises/binary-search/tests/binary-search.rs +96 -0
- data/tracks/typescript/common/package.json +6 -6
- data/tracks/typescript/common/yarn.lock +929 -610
- data/tracks/typescript/exercises/acronym/package.json +6 -6
- data/tracks/typescript/exercises/acronym/yarn.lock +929 -610
- data/tracks/typescript/exercises/anagram/package.json +6 -6
- data/tracks/typescript/exercises/anagram/yarn.lock +929 -610
- data/tracks/typescript/exercises/beer-song/package.json +6 -6
- data/tracks/typescript/exercises/beer-song/yarn.lock +929 -610
- data/tracks/typescript/exercises/binary-search-tree/package.json +6 -6
- data/tracks/typescript/exercises/binary-search-tree/yarn.lock +929 -610
- data/tracks/typescript/exercises/binary-search/package.json +6 -6
- data/tracks/typescript/exercises/binary-search/yarn.lock +929 -610
- data/tracks/typescript/exercises/bob/package.json +6 -6
- data/tracks/typescript/exercises/bob/yarn.lock +929 -610
- data/tracks/typescript/exercises/circular-buffer/package.json +6 -6
- data/tracks/typescript/exercises/circular-buffer/yarn.lock +929 -610
- data/tracks/typescript/exercises/clock/package.json +6 -6
- data/tracks/typescript/exercises/clock/yarn.lock +929 -610
- data/tracks/typescript/exercises/difference-of-squares/package.json +6 -6
- data/tracks/typescript/exercises/difference-of-squares/yarn.lock +929 -610
- data/tracks/typescript/exercises/etl/package.json +6 -6
- data/tracks/typescript/exercises/etl/yarn.lock +929 -610
- data/tracks/typescript/exercises/food-chain/package.json +6 -6
- data/tracks/typescript/exercises/food-chain/yarn.lock +929 -610
- data/tracks/typescript/exercises/gigasecond/package.json +6 -6
- data/tracks/typescript/exercises/gigasecond/yarn.lock +929 -610
- data/tracks/typescript/exercises/grade-school/package.json +6 -6
- data/tracks/typescript/exercises/grade-school/yarn.lock +929 -610
- data/tracks/typescript/exercises/hamming/package.json +6 -6
- data/tracks/typescript/exercises/hamming/yarn.lock +929 -610
- data/tracks/typescript/exercises/hello-world/README.md +354 -0
- data/tracks/typescript/exercises/hello-world/package.json +6 -6
- data/tracks/typescript/exercises/hello-world/yarn.lock +929 -610
- data/tracks/typescript/exercises/largest-series-product/package.json +6 -6
- data/tracks/typescript/exercises/largest-series-product/yarn.lock +929 -610
- data/tracks/typescript/exercises/leap/package.json +6 -6
- data/tracks/typescript/exercises/leap/yarn.lock +929 -610
- data/tracks/typescript/exercises/linked-list/package.json +6 -6
- data/tracks/typescript/exercises/linked-list/yarn.lock +929 -610
- data/tracks/typescript/exercises/nth-prime/package.json +6 -6
- data/tracks/typescript/exercises/nth-prime/yarn.lock +929 -610
- data/tracks/typescript/exercises/pangram/package.json +6 -6
- data/tracks/typescript/exercises/pangram/yarn.lock +929 -610
- data/tracks/typescript/exercises/pascals-triangle/package.json +6 -6
- data/tracks/typescript/exercises/pascals-triangle/yarn.lock +929 -610
- data/tracks/typescript/exercises/phone-number/package.json +6 -6
- data/tracks/typescript/exercises/phone-number/yarn.lock +929 -610
- data/tracks/typescript/exercises/prime-factors/package.json +6 -6
- data/tracks/typescript/exercises/prime-factors/yarn.lock +929 -610
- data/tracks/typescript/exercises/raindrops/package.json +6 -6
- data/tracks/typescript/exercises/raindrops/yarn.lock +929 -610
- data/tracks/typescript/exercises/rna-transcription/package.json +6 -6
- data/tracks/typescript/exercises/rna-transcription/yarn.lock +929 -610
- data/tracks/typescript/exercises/robot-name/package.json +6 -6
- data/tracks/typescript/exercises/robot-name/yarn.lock +929 -610
- data/tracks/typescript/exercises/robot-simulator/package.json +6 -6
- data/tracks/typescript/exercises/robot-simulator/yarn.lock +929 -610
- data/tracks/typescript/exercises/rotational-cipher/package.json +6 -6
- data/tracks/typescript/exercises/rotational-cipher/yarn.lock +929 -610
- data/tracks/typescript/exercises/say/package.json +6 -6
- data/tracks/typescript/exercises/say/yarn.lock +929 -610
- data/tracks/typescript/exercises/scrabble-score/package.json +6 -6
- data/tracks/typescript/exercises/scrabble-score/yarn.lock +929 -610
- data/tracks/typescript/exercises/series/package.json +6 -6
- data/tracks/typescript/exercises/series/yarn.lock +929 -610
- data/tracks/typescript/exercises/space-age/package.json +6 -6
- data/tracks/typescript/exercises/space-age/yarn.lock +929 -610
- data/tracks/typescript/exercises/strain/package.json +6 -6
- data/tracks/typescript/exercises/strain/yarn.lock +929 -610
- data/tracks/typescript/exercises/sum-of-multiples/package.json +6 -6
- data/tracks/typescript/exercises/sum-of-multiples/yarn.lock +929 -610
- data/tracks/typescript/exercises/triangle/package.json +6 -6
- data/tracks/typescript/exercises/triangle/yarn.lock +929 -610
- data/tracks/typescript/exercises/word-count/package.json +6 -6
- data/tracks/typescript/exercises/word-count/yarn.lock +929 -610
- data/tracks/typescript/exercises/wordy/package.json +6 -6
- data/tracks/typescript/exercises/wordy/yarn.lock +929 -610
- metadata +37 -2
@@ -76,9 +76,9 @@ def validate_rect(rect, input):
|
|
76
76
|
# validate connection at every corner
|
77
77
|
# with neighbours on the same line and col
|
78
78
|
for i in range(0, len(rect)):
|
79
|
-
|
80
|
-
|
81
|
-
if not path(rect[i],
|
79
|
+
line = same_line(rect[i].i, rect[0:i] + rect[i + 1:])
|
80
|
+
column = same_col(rect[i].j, rect[0:i] + rect[i + 1:])
|
81
|
+
if not path(rect[i], line, input) or not path(rect[i], column, input):
|
82
82
|
return False
|
83
83
|
return True
|
84
84
|
|
@@ -18,13 +18,12 @@ each nucleotide with its complement:
|
|
18
18
|
* `T` -> `A`
|
19
19
|
* `A` -> `U`
|
20
20
|
|
21
|
-
|
21
|
+
## Submitting Exercises
|
22
22
|
|
23
23
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
24
24
|
|
25
25
|
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`.
|
26
26
|
|
27
|
-
|
28
27
|
For more detailed information about running tests, code style and linting,
|
29
28
|
please see the [help page](http://exercism.io/languages/python).
|
30
29
|
|
@@ -3,15 +3,16 @@ import unittest
|
|
3
3
|
from rna_transcription import to_rna
|
4
4
|
|
5
5
|
|
6
|
-
#
|
6
|
+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.1
|
7
7
|
|
8
8
|
class DNATests(unittest.TestCase):
|
9
|
-
def test_transcribes_guanine_to_cytosine(self):
|
10
|
-
self.assertEqual(to_rna('G'), 'C')
|
11
9
|
|
12
10
|
def test_transcribes_cytosine_to_guanine(self):
|
13
11
|
self.assertEqual(to_rna('C'), 'G')
|
14
12
|
|
13
|
+
def test_transcribes_guanine_to_cytosine(self):
|
14
|
+
self.assertEqual(to_rna('G'), 'C')
|
15
|
+
|
15
16
|
def test_transcribes_thymine_to_adenine(self):
|
16
17
|
self.assertEqual(to_rna('T'), 'A')
|
17
18
|
|
@@ -15,13 +15,12 @@ The names must be random: they should not follow a predictable sequence.
|
|
15
15
|
Random names means a risk of collisions. Your solution must ensure that
|
16
16
|
every existing robot has a unique name.
|
17
17
|
|
18
|
-
|
18
|
+
## Submitting Exercises
|
19
19
|
|
20
20
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
21
21
|
|
22
22
|
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`.
|
23
23
|
|
24
|
-
|
25
24
|
For more detailed information about running tests, code style and linting,
|
26
25
|
please see the [help page](http://exercism.io/languages/python).
|
27
26
|
|
@@ -27,13 +27,12 @@ direction it is pointing.
|
|
27
27
|
- Say a robot starts at {7, 3} facing north. Then running this stream
|
28
28
|
of instructions should leave it at {9, 4} facing west.
|
29
29
|
|
30
|
-
|
30
|
+
## Submitting Exercises
|
31
31
|
|
32
32
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
33
33
|
|
34
34
|
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`.
|
35
35
|
|
36
|
-
|
37
36
|
For more detailed information about running tests, code style and linting,
|
38
37
|
please see the [help page](http://exercism.io/languages/python).
|
39
38
|
|
@@ -14,7 +14,7 @@ The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice
|
|
14
14
|
these letters have lots of straight lines and are hence easy to hack
|
15
15
|
into stone tablets).
|
16
16
|
|
17
|
-
```
|
17
|
+
```text
|
18
18
|
1 => I
|
19
19
|
10 => X
|
20
20
|
7 => VII
|
@@ -42,13 +42,12 @@ In Roman numerals 1990 is MCMXC:
|
|
42
42
|
|
43
43
|
See also: http://www.novaroma.org/via_romana/numbers.html
|
44
44
|
|
45
|
-
|
45
|
+
## Submitting Exercises
|
46
46
|
|
47
47
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
48
48
|
|
49
49
|
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`.
|
50
50
|
|
51
|
-
|
52
51
|
For more detailed information about running tests, code style and linting,
|
53
52
|
please see the [help page](http://exercism.io/languages/python).
|
54
53
|
|
@@ -13,7 +13,7 @@ The most commonly used rotational cipher is `ROT13`.
|
|
13
13
|
|
14
14
|
A `ROT13` on the Latin alphabet would be as follows:
|
15
15
|
|
16
|
-
```
|
16
|
+
```text
|
17
17
|
Plain: abcdefghijklmnopqrstuvwxyz
|
18
18
|
Cipher: nopqrstuvwxyzabcdefghijklm
|
19
19
|
```
|
@@ -23,19 +23,19 @@ It is stronger than the Atbash cipher because it has 27 possible keys, and 25 us
|
|
23
23
|
Ciphertext is written out in the same formatting as the input including spaces and punctuation.
|
24
24
|
|
25
25
|
## Examples
|
26
|
+
|
26
27
|
- ROT5 `omg` gives `trl`
|
27
28
|
- ROT0 `c` gives `c`
|
28
29
|
- ROT26 `Cool` gives `Cool`
|
29
30
|
- ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.`
|
30
31
|
- ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.`
|
31
32
|
|
32
|
-
|
33
|
+
## Submitting Exercises
|
33
34
|
|
34
35
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
35
36
|
|
36
37
|
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`.
|
37
38
|
|
38
|
-
|
39
39
|
For more detailed information about running tests, code style and linting,
|
40
40
|
please see the [help page](http://exercism.io/languages/python).
|
41
41
|
|
@@ -7,29 +7,28 @@ Run-length encoding (RLE) is a simple form of data compression, where runs
|
|
7
7
|
|
8
8
|
For example we can represent the original 53 characters with only 13.
|
9
9
|
|
10
|
-
```
|
10
|
+
```text
|
11
11
|
"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB"
|
12
12
|
```
|
13
13
|
|
14
14
|
RLE allows the original data to be perfectly reconstructed from
|
15
15
|
the compressed data, which makes it a lossless data compression.
|
16
16
|
|
17
|
-
```
|
17
|
+
```text
|
18
18
|
"AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE"
|
19
19
|
```
|
20
20
|
|
21
21
|
For simplicity, you can assume that the unencoded string will only contain
|
22
|
-
the letters A through Z (either lower or upper case) and whitespace. This way
|
23
|
-
data to be encoded will never contain any numbers and numbers inside data to
|
22
|
+
the letters A through Z (either lower or upper case) and whitespace. This way
|
23
|
+
data to be encoded will never contain any numbers and numbers inside data to
|
24
24
|
be decoded always represent the count for the following character.
|
25
25
|
|
26
|
-
|
26
|
+
## Submitting Exercises
|
27
27
|
|
28
28
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
29
29
|
|
30
30
|
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`.
|
31
31
|
|
32
|
-
|
33
32
|
For more detailed information about running tests, code style and linting,
|
34
33
|
please see the [help page](http://exercism.io/languages/python).
|
35
34
|
|
@@ -8,6 +8,6 @@ def decode(string):
|
|
8
8
|
|
9
9
|
def encode(string):
|
10
10
|
def single_helper(k, g):
|
11
|
-
|
12
|
-
return k if
|
11
|
+
size = len(list(g))
|
12
|
+
return k if size == 1 else str(size) + k
|
13
13
|
return ''.join(single_helper(key, group) for key, group in groupby(string))
|
@@ -4,7 +4,7 @@ Detect saddle points in a matrix.
|
|
4
4
|
|
5
5
|
So say you have a matrix like so:
|
6
6
|
|
7
|
-
```
|
7
|
+
```text
|
8
8
|
0 1 2
|
9
9
|
|---------
|
10
10
|
0 | 9 8 7
|
@@ -26,13 +26,12 @@ saddle points for any given matrix.
|
|
26
26
|
Note that you may find other definitions of matrix saddle points online,
|
27
27
|
but the tests for this exercise follow the above unambiguous definition.
|
28
28
|
|
29
|
-
|
29
|
+
## Submitting Exercises
|
30
30
|
|
31
31
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
32
32
|
|
33
33
|
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`.
|
34
34
|
|
35
|
-
|
36
35
|
For more detailed information about running tests, code style and linting,
|
37
36
|
please see the [help page](http://exercism.io/languages/python).
|
38
37
|
|
@@ -62,13 +62,12 @@ Use _and_ (correctly) when spelling out the number in English:
|
|
62
62
|
- 1002 becomes "one thousand and two".
|
63
63
|
- 1323 becomes "one thousand three hundred and twenty-three".
|
64
64
|
|
65
|
-
|
65
|
+
## Submitting Exercises
|
66
66
|
|
67
67
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
68
68
|
|
69
69
|
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`.
|
70
70
|
|
71
|
-
|
72
71
|
For more detailed information about running tests, code style and linting,
|
73
72
|
please see the [help page](http://exercism.io/languages/python).
|
74
73
|
|
@@ -32,7 +32,6 @@ Use Flats:
|
|
32
32
|
F, Bb, Eb, Ab, Db, Gb major
|
33
33
|
d, g, c, f, bb, eb minor
|
34
34
|
|
35
|
-
|
36
35
|
The diatonic scales, and all other scales that derive from the
|
37
36
|
chromatic scale, are built upon intervals. An interval is the space
|
38
37
|
between two pitches.
|
@@ -56,13 +55,12 @@ Here is a table of pitches with the names of their interval distance from the to
|
|
56
55
|
| | | Dim 3rd | Aug 2nd | Dim 4th | | Aug 4th | Dim 5th | Aug 5th | Dim 7th | Aug 6th | Dim 8ve | |
|
57
56
|
| | | | | | | Dim 5th | | | | | | |
|
58
57
|
|
59
|
-
|
58
|
+
## Submitting Exercises
|
60
59
|
|
61
60
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
62
61
|
|
63
62
|
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`.
|
64
63
|
|
65
|
-
|
66
64
|
For more detailed information about running tests, code style and linting,
|
67
65
|
please see the [help page](http://exercism.io/languages/python).
|
68
66
|
|
@@ -6,7 +6,7 @@ Given a word, compute the scrabble score for that word.
|
|
6
6
|
|
7
7
|
You'll need these:
|
8
8
|
|
9
|
-
```
|
9
|
+
```text
|
10
10
|
Letter Value
|
11
11
|
A, E, I, O, U, L, N, R, S, T 1
|
12
12
|
D, G 2
|
@@ -18,6 +18,7 @@ Q, Z 10
|
|
18
18
|
```
|
19
19
|
|
20
20
|
## Examples
|
21
|
+
|
21
22
|
"cabbage" should be scored as worth 14 points:
|
22
23
|
|
23
24
|
- 3 points for C
|
@@ -34,16 +35,16 @@ And to total:
|
|
34
35
|
- = 14
|
35
36
|
|
36
37
|
## Extensions
|
38
|
+
|
37
39
|
- You can play a double or a triple letter.
|
38
40
|
- You can play a double or a triple word.
|
39
41
|
|
40
|
-
|
42
|
+
## Submitting Exercises
|
41
43
|
|
42
44
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
43
45
|
|
44
46
|
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`.
|
45
47
|
|
46
|
-
|
47
48
|
For more detailed information about running tests, code style and linting,
|
48
49
|
please see the [help page](http://exercism.io/languages/python).
|
49
50
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
You and your fellow cohort of those in the "know" when it comes to
|
7
7
|
binary decide to come up with a secret "handshake".
|
8
8
|
|
9
|
-
```
|
9
|
+
```text
|
10
10
|
1 = wink
|
11
11
|
10 = double blink
|
12
12
|
100 = close your eyes
|
@@ -28,13 +28,12 @@ Given the input 19, the function would return the array
|
|
28
28
|
Notice that the addition of 16 (10000 in binary)
|
29
29
|
has caused the array to be reversed.
|
30
30
|
|
31
|
-
|
31
|
+
## Submitting Exercises
|
32
32
|
|
33
33
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
34
34
|
|
35
35
|
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`.
|
36
36
|
|
37
|
-
|
38
37
|
For more detailed information about running tests, code style and linting,
|
39
38
|
please see the [help page](http://exercism.io/languages/python).
|
40
39
|
|
@@ -20,13 +20,12 @@ whatever you get.
|
|
20
20
|
Note that these series are only required to occupy *adjacent positions*
|
21
21
|
in the input; the digits need not be *numerically consecutive*.
|
22
22
|
|
23
|
-
|
23
|
+
## Submitting Exercises
|
24
24
|
|
25
25
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
26
26
|
|
27
27
|
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`.
|
28
28
|
|
29
|
-
|
30
29
|
For more detailed information about running tests, code style and linting,
|
31
30
|
please see the [help page](http://exercism.io/languages/python).
|
32
31
|
|
@@ -27,13 +27,12 @@ Notice that this is a very specific algorithm, and the tests don't check
|
|
27
27
|
that you've implemented the algorithm, only that you've come up with the
|
28
28
|
correct list of primes.
|
29
29
|
|
30
|
-
|
30
|
+
## Submitting Exercises
|
31
31
|
|
32
32
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
33
33
|
|
34
34
|
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`.
|
35
35
|
|
36
|
-
|
37
36
|
For more detailed information about running tests, code style and linting,
|
38
37
|
please see the [help page](http://exercism.io/languages/python).
|
39
38
|
|
@@ -47,7 +47,7 @@ Given the key "aaaaaaaaaaaaaaaaaa", encoding the string "iamapandabear"
|
|
47
47
|
would return the original "iamapandabear".
|
48
48
|
|
49
49
|
Given the key "ddddddddddddddddd", encoding our string "iamapandabear"
|
50
|
-
would return the obscured "
|
50
|
+
would return the obscured "ldpdsdqgdehdu"
|
51
51
|
|
52
52
|
In the example above, we've set a = 0 for the key value. So when the
|
53
53
|
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
|
|
65
65
|
at least 100 characters in length, accessible via Cipher#key (the #
|
66
66
|
syntax means instance variable)
|
67
67
|
|
68
|
-
If the key submitted has capital letters or numbers, throw
|
68
|
+
If the key submitted has capital letters or numbers, throw a
|
69
69
|
ValueError with a message to that effect.
|
70
70
|
|
71
71
|
## Extensions
|
@@ -100,13 +100,12 @@ cryptographically strong random numbers that provide the greater security requir
|
|
100
100
|
Since this is only an exercise, `random` is fine to use, but note that **it would be
|
101
101
|
very insecure if actually used for cryptography.**
|
102
102
|
|
103
|
-
|
103
|
+
## Submitting Exercises
|
104
104
|
|
105
105
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
106
106
|
|
107
107
|
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`.
|
108
108
|
|
109
|
-
|
110
109
|
For more detailed information about running tests, code style and linting,
|
111
110
|
please see the [help page](http://exercism.io/languages/python).
|
112
111
|
|
@@ -12,18 +12,17 @@ Given an age in seconds, calculate how old someone would be on:
|
|
12
12
|
- Neptune: orbital period 164.79132 Earth years
|
13
13
|
|
14
14
|
So if you were told someone were 1,000,000,000 seconds old, you should
|
15
|
-
be able to say that they're 31 Earth-years old.
|
15
|
+
be able to say that they're 31.69 Earth-years old.
|
16
16
|
|
17
17
|
If you're wondering why Pluto didn't make the cut, go watch [this
|
18
18
|
youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
|
19
19
|
|
20
|
-
|
20
|
+
## Submitting Exercises
|
21
21
|
|
22
22
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
23
23
|
|
24
24
|
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`.
|
25
25
|
|
26
|
-
|
27
26
|
For more detailed information about running tests, code style and linting,
|
28
27
|
please see the [help page](http://exercism.io/languages/python).
|
29
28
|
|
@@ -3,49 +3,38 @@ import unittest
|
|
3
3
|
from space_age import SpaceAge
|
4
4
|
|
5
5
|
|
6
|
+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
|
7
|
+
|
6
8
|
class SpaceAgeTest(unittest.TestCase):
|
7
|
-
def test_age_in_seconds(self):
|
8
|
-
age = SpaceAge(1e6)
|
9
|
-
self.assertEqual(age.seconds, 1e6)
|
10
9
|
|
11
|
-
def
|
12
|
-
|
13
|
-
self.assertEqual(age.on_earth(), 31.69)
|
10
|
+
def test_age_on_mercury(self):
|
11
|
+
self.assertEqual(SpaceAge(2134835688).on_mercury(), 280.88)
|
14
12
|
|
15
|
-
def
|
16
|
-
|
17
|
-
self.assertEqual(age.on_earth(), 67.65)
|
18
|
-
self.assertEqual(age.on_mercury(), 280.88)
|
13
|
+
def test_age_on_venus(self):
|
14
|
+
self.assertEqual(SpaceAge(189839836).on_venus(), 9.78)
|
19
15
|
|
20
|
-
def
|
21
|
-
|
22
|
-
self.assertEqual(age.on_earth(), 6.02)
|
23
|
-
self.assertEqual(age.on_venus(), 9.78)
|
16
|
+
def test_age_on_earth(self):
|
17
|
+
self.assertEqual(SpaceAge(1000000000).on_earth(), 31.69)
|
24
18
|
|
25
19
|
def test_age_on_mars(self):
|
26
|
-
|
27
|
-
self.assertEqual(age.on_earth(), 73.83)
|
28
|
-
self.assertEqual(age.on_mars(), 39.25)
|
20
|
+
self.assertEqual(SpaceAge(2329871239).on_mars(), 39.25)
|
29
21
|
|
30
22
|
def test_age_on_jupiter(self):
|
31
|
-
|
32
|
-
self.assertEqual(age.on_earth(), 28.58)
|
33
|
-
self.assertEqual(age.on_jupiter(), 2.41)
|
23
|
+
self.assertEqual(SpaceAge(901876382).on_jupiter(), 2.41)
|
34
24
|
|
35
25
|
def test_age_on_saturn(self):
|
36
|
-
|
37
|
-
self.assertEqual(age.on_earth(), 95.06)
|
38
|
-
self.assertEqual(age.on_saturn(), 3.23)
|
26
|
+
self.assertEqual(SpaceAge(3000000000).on_saturn(), 3.23)
|
39
27
|
|
40
28
|
def test_age_on_uranus(self):
|
41
|
-
|
42
|
-
self.assertEqual(age.on_earth(), 101.72)
|
43
|
-
self.assertEqual(age.on_uranus(), 1.21)
|
29
|
+
self.assertEqual(SpaceAge(3210123456).on_uranus(), 1.21)
|
44
30
|
|
45
31
|
def test_age_on_neptune(self):
|
46
|
-
|
47
|
-
|
48
|
-
|
32
|
+
self.assertEqual(SpaceAge(8210123456).on_neptune(), 1.58)
|
33
|
+
|
34
|
+
# Additional tests for this track
|
35
|
+
|
36
|
+
def test_age_in_seconds(self):
|
37
|
+
self.assertEqual(SpaceAge(1e6).seconds, 1e6)
|
49
38
|
|
50
39
|
|
51
40
|
if __name__ == '__main__':
|