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
@@ -3,6 +3,7 @@
|
|
3
3
|
We are going to do the `Transform` step of an Extract-Transform-Load.
|
4
4
|
|
5
5
|
### ETL
|
6
|
+
|
6
7
|
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
|
7
8
|
we're going to migrate this."
|
8
9
|
|
@@ -11,6 +12,7 @@ once." That's then typically followed by much forehead slapping and
|
|
11
12
|
moaning about how stupid we could possibly be.)
|
12
13
|
|
13
14
|
### The goal
|
15
|
+
|
14
16
|
We're going to extract some scrabble scores from a legacy system.
|
15
17
|
|
16
18
|
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
|
|
44
46
|
example, an "E" is scored at 2 in the Māori-language version of the
|
45
47
|
game while being scored at 4 in the Hawaiian-language version.
|
46
48
|
|
47
|
-
|
49
|
+
## Submitting Exercises
|
48
50
|
|
49
51
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
50
52
|
|
51
53
|
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`.
|
52
54
|
|
53
|
-
|
54
55
|
For more detailed information about running tests, code style and linting,
|
55
56
|
please see the [help page](http://exercism.io/languages/python).
|
56
57
|
|
@@ -3,21 +3,19 @@
|
|
3
3
|
Take a nested list and return a single flattened list with all values except nil/null.
|
4
4
|
|
5
5
|
The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values.
|
6
|
-
|
6
|
+
|
7
7
|
For Example
|
8
8
|
|
9
9
|
input: [1,[2,3,null,4],[null],5]
|
10
10
|
|
11
11
|
output: [1,2,3,4,5]
|
12
12
|
|
13
|
-
|
14
|
-
### Submitting Exercises
|
13
|
+
## Submitting Exercises
|
15
14
|
|
16
15
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
17
16
|
|
18
17
|
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`.
|
19
18
|
|
20
|
-
|
21
19
|
For more detailed information about running tests, code style and linting,
|
22
20
|
please see the [help page](http://exercism.io/languages/python).
|
23
21
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Food
|
1
|
+
# Food Chain
|
2
2
|
|
3
3
|
Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly'.
|
4
4
|
|
@@ -63,19 +63,18 @@ I know an old lady who swallowed a horse.
|
|
63
63
|
She's dead, of course!
|
64
64
|
```
|
65
65
|
|
66
|
-
|
66
|
+
## Submitting Exercises
|
67
67
|
|
68
68
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
69
69
|
|
70
70
|
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`.
|
71
71
|
|
72
|
-
|
73
72
|
For more detailed information about running tests, code style and linting,
|
74
73
|
please see the [help page](http://exercism.io/languages/python).
|
75
74
|
|
76
75
|
## Source
|
77
76
|
|
78
|
-
|
77
|
+
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)
|
79
78
|
|
80
79
|
## Submitting Incomplete Solutions
|
81
80
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -25,19 +25,15 @@ enough.)
|
|
25
25
|
|
26
26
|
Words are case-insensitive.
|
27
27
|
|
28
|
-
##
|
29
|
-
- 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/).
|
30
|
-
|
31
|
-
|
32
|
-
### Submitting Exercises
|
28
|
+
## Submitting Exercises
|
33
29
|
|
34
30
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
35
31
|
|
36
32
|
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
33
|
|
38
|
-
|
39
34
|
For more detailed information about running tests, code style and linting,
|
40
35
|
please see the [help page](http://exercism.io/languages/python).
|
41
36
|
|
37
|
+
|
42
38
|
## Submitting Incomplete Solutions
|
43
39
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -4,13 +4,12 @@ Calculate the moment when someone has lived for 10^9 seconds.
|
|
4
4
|
|
5
5
|
A gigasecond is 10^9 (1,000,000,000) seconds.
|
6
6
|
|
7
|
-
|
7
|
+
## Submitting Exercises
|
8
8
|
|
9
9
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
10
10
|
|
11
11
|
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`.
|
12
12
|
|
13
|
-
|
14
13
|
For more detailed information about running tests, code style and linting,
|
15
14
|
please see the [help page](http://exercism.io/languages/python).
|
16
15
|
|
@@ -21,7 +21,6 @@ In the end, you should be able to:
|
|
21
21
|
Note that all our students only have one name. (It's a small town, what
|
22
22
|
do you want?)
|
23
23
|
|
24
|
-
|
25
24
|
## For bonus points
|
26
25
|
|
27
26
|
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:
|
|
35
34
|
Then please share your thoughts in a comment on the submission. Did this
|
36
35
|
experiment make the code better? Worse? Did you learn anything from it?
|
37
36
|
|
38
|
-
|
37
|
+
## Submitting Exercises
|
39
38
|
|
40
39
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
41
40
|
|
42
41
|
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`.
|
43
42
|
|
44
|
-
|
45
43
|
For more detailed information about running tests, code style and linting,
|
46
44
|
please see the [help page](http://exercism.io/languages/python).
|
47
45
|
|
@@ -15,7 +15,6 @@ Write code that shows:
|
|
15
15
|
- how many grains were on each square, and
|
16
16
|
- the total number of grains
|
17
17
|
|
18
|
-
|
19
18
|
## For bonus points
|
20
19
|
|
21
20
|
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:
|
|
27
26
|
Then please share your thoughts in a comment on the submission. Did this
|
28
27
|
experiment make the code better? Worse? Did you learn anything from it?
|
29
28
|
|
30
|
-
|
29
|
+
## Submitting Exercises
|
31
30
|
|
32
31
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
33
32
|
|
34
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`.
|
35
34
|
|
36
|
-
|
37
35
|
For more detailed information about running tests, code style and linting,
|
38
36
|
please see the [help page](http://exercism.io/languages/python).
|
39
37
|
|
@@ -3,14 +3,14 @@
|
|
3
3
|
Search a file for lines matching a regular expression pattern. Return the line
|
4
4
|
number and contents of each matching line.
|
5
5
|
|
6
|
-
The Unix [`grep`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html) command can be used to search for lines in one or more files
|
6
|
+
The Unix [`grep`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html) command can be used to search for lines in one or more files
|
7
7
|
that match a user-provided search query (known as the *pattern*).
|
8
8
|
|
9
9
|
The `grep` command takes three arguments:
|
10
10
|
|
11
|
-
1. The pattern used to match lines in a file.
|
11
|
+
1. The pattern used to match lines in a file.
|
12
12
|
2. Zero or more flags to customize the matching behavior.
|
13
|
-
3. One or more files in which to search for matching lines.
|
13
|
+
3. One or more files in which to search for matching lines.
|
14
14
|
|
15
15
|
Your task is to implement the `grep` function, which should read the contents
|
16
16
|
of the specified files, find the lines that match the specified pattern
|
@@ -20,18 +20,18 @@ in the first file being output first.
|
|
20
20
|
|
21
21
|
As an example, suppose there is a file named "input.txt" with the following contents:
|
22
22
|
|
23
|
-
|
23
|
+
```text
|
24
24
|
hello
|
25
25
|
world
|
26
26
|
hello again
|
27
|
-
|
27
|
+
```
|
28
28
|
|
29
29
|
If we were to call `grep "hello" input.txt`, the returned string should be:
|
30
30
|
|
31
|
-
|
31
|
+
```text
|
32
32
|
hello
|
33
33
|
hello again
|
34
|
-
|
34
|
+
```
|
35
35
|
|
36
36
|
### Flags
|
37
37
|
|
@@ -46,31 +46,30 @@ As said earlier, the `grep` command should also support the following flags:
|
|
46
46
|
If we run `grep -n "hello" input.txt`, the `-n` flag will require the matching
|
47
47
|
lines to be prefixed with its line number:
|
48
48
|
|
49
|
-
|
49
|
+
```text
|
50
50
|
1:hello
|
51
51
|
3:hello again
|
52
|
-
|
52
|
+
```
|
53
53
|
|
54
|
-
And if we run `grep -i "HELLO" input.txt`, we'll do a case-insensitive match,
|
54
|
+
And if we run `grep -i "HELLO" input.txt`, we'll do a case-insensitive match,
|
55
55
|
and the output will be:
|
56
56
|
|
57
|
-
|
57
|
+
```text
|
58
58
|
hello
|
59
59
|
hello again
|
60
|
-
|
60
|
+
```
|
61
61
|
|
62
62
|
The `grep` command should support multiple flags at once.
|
63
63
|
|
64
64
|
For example, running `grep -l -v "hello" file1.txt file2.txt` should
|
65
65
|
print the names of files that do not contain the string "hello".
|
66
66
|
|
67
|
-
|
67
|
+
## Submitting Exercises
|
68
68
|
|
69
69
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
70
70
|
|
71
71
|
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`.
|
72
72
|
|
73
|
-
|
74
73
|
For more detailed information about running tests, code style and linting,
|
75
74
|
please see the [help page](http://exercism.io/languages/python).
|
76
75
|
|
@@ -35,13 +35,12 @@ The Hamming distance is only defined for sequences of equal length. This means
|
|
35
35
|
that based on the definition, each language could deal with getting sequences
|
36
36
|
of equal length differently.
|
37
37
|
|
38
|
-
|
38
|
+
## Submitting Exercises
|
39
39
|
|
40
40
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
41
41
|
|
42
42
|
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`.
|
43
43
|
|
44
|
-
|
45
44
|
For more detailed information about running tests, code style and linting,
|
46
45
|
please see the [help page](http://exercism.io/languages/python).
|
47
46
|
|
@@ -3,10 +3,13 @@ import unittest
|
|
3
3
|
import hamming
|
4
4
|
|
5
5
|
|
6
|
-
#
|
6
|
+
# Tests adapted from `problem-specifications//canonical-data.json` @ v2.0.1
|
7
7
|
|
8
8
|
class HammingTest(unittest.TestCase):
|
9
9
|
|
10
|
+
def test_empty_strands(self):
|
11
|
+
self.assertEqual(hamming.distance("", ""), 0)
|
12
|
+
|
10
13
|
def test_identical_strands(self):
|
11
14
|
self.assertEqual(hamming.distance("A", "A"), 0)
|
12
15
|
|
@@ -29,10 +32,10 @@ class HammingTest(unittest.TestCase):
|
|
29
32
|
self.assertEqual(hamming.distance("ACCAGGG", "ACTATGG"), 2)
|
30
33
|
|
31
34
|
def test_non_unique_character_in_first_strand(self):
|
32
|
-
self.assertEqual(hamming.distance("
|
35
|
+
self.assertEqual(hamming.distance("AAG", "AAA"), 1)
|
33
36
|
|
34
37
|
def test_non_unique_character_in_second_strand(self):
|
35
|
-
self.assertEqual(hamming.distance("
|
38
|
+
self.assertEqual(hamming.distance("AAA", "AAG"), 1)
|
36
39
|
|
37
40
|
def test_same_nucleotides_in_different_positions(self):
|
38
41
|
self.assertEqual(hamming.distance("TAG", "GAT"), 2)
|
@@ -43,9 +46,6 @@ class HammingTest(unittest.TestCase):
|
|
43
46
|
def test_large_distance_in_off_by_one_strand(self):
|
44
47
|
self.assertEqual(hamming.distance("GGACGGATTCTG", "AGGACGGATTCT"), 9)
|
45
48
|
|
46
|
-
def test_empty_strands(self):
|
47
|
-
self.assertEqual(hamming.distance("", ""), 0)
|
48
|
-
|
49
49
|
def test_disallow_first_strand_longer(self):
|
50
50
|
with self.assertRaises(ValueError):
|
51
51
|
hamming.distance("AATG", "AAA")
|
@@ -14,13 +14,12 @@ The objectives are simple:
|
|
14
14
|
|
15
15
|
If everything goes well, you will be ready to fetch your first real exercise.
|
16
16
|
|
17
|
-
|
17
|
+
## Submitting Exercises
|
18
18
|
|
19
19
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
20
20
|
|
21
21
|
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`.
|
22
22
|
|
23
|
-
|
24
23
|
For more detailed information about running tests, code style and linting,
|
25
24
|
please see the [help page](http://exercism.io/languages/python).
|
26
25
|
|
@@ -7,13 +7,12 @@ teal: 008080, navy: 000080).
|
|
7
7
|
|
8
8
|
The program should handle invalid hexadecimal strings.
|
9
9
|
|
10
|
-
|
10
|
+
## Submitting Exercises
|
11
11
|
|
12
12
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
13
13
|
|
14
14
|
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`.
|
15
15
|
|
16
|
-
|
17
16
|
For more detailed information about running tests, code style and linting,
|
18
17
|
please see the [help page](http://exercism.io/languages/python).
|
19
18
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
from functools import reduce
|
2
2
|
|
3
3
|
|
4
|
-
def hexa(
|
5
|
-
|
6
|
-
if set(
|
4
|
+
def hexa(hex_str):
|
5
|
+
hex_str = hex_str.lower()
|
6
|
+
if set(hex_str) - set('0123456789abcdef'):
|
7
7
|
raise ValueError('Invalid hexadecimal string')
|
8
|
-
|
9
|
-
|
10
|
-
return reduce(lambda x, y: x * 16 + y,
|
8
|
+
digits = [ord(c) - ord('a') + 10 if c in 'abcdef' else ord(c) - ord('0')
|
9
|
+
for c in hex_str]
|
10
|
+
return reduce(lambda x, y: x * 16 + y, digits, 0)
|
@@ -11,10 +11,9 @@ Output the nursery rhyme 'This is the House that Jack Built'.
|
|
11
11
|
|
12
12
|
- [papyr.com](http://papyr.com/hypertextbooks/grammar/ph_noun.htm)
|
13
13
|
|
14
|
-
|
15
14
|
The nursery rhyme reads as follows:
|
16
15
|
|
17
|
-
```
|
16
|
+
```text
|
18
17
|
This is the house that Jack built.
|
19
18
|
|
20
19
|
This is the malt
|
@@ -106,13 +105,12 @@ that ate the malt
|
|
106
105
|
that lay in the house that Jack built.
|
107
106
|
```
|
108
107
|
|
109
|
-
|
108
|
+
## Submitting Exercises
|
110
109
|
|
111
110
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
112
111
|
|
113
112
|
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`.
|
114
113
|
|
115
|
-
|
116
114
|
For more detailed information about running tests, code style and linting,
|
117
115
|
please see the [help page](http://exercism.io/languages/python).
|
118
116
|
|
@@ -2,23 +2,23 @@
|
|
2
2
|
|
3
3
|
Determine if a word or phrase is an isogram.
|
4
4
|
|
5
|
-
An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter.
|
5
|
+
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.
|
6
6
|
|
7
7
|
Examples of isograms:
|
8
8
|
|
9
9
|
- lumberjacks
|
10
10
|
- background
|
11
11
|
- downstream
|
12
|
+
- six-year-old
|
12
13
|
|
13
14
|
The word *isograms*, however, is not an isogram, because the s repeats.
|
14
15
|
|
15
|
-
|
16
|
+
## Submitting Exercises
|
16
17
|
|
17
18
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
18
19
|
|
19
20
|
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`.
|
20
21
|
|
21
|
-
|
22
22
|
For more detailed information about running tests, code style and linting,
|
23
23
|
please see the [help page](http://exercism.io/languages/python).
|
24
24
|
|
@@ -3,19 +3,19 @@
|
|
3
3
|
Given a diagram, determine which plants each child in the kindergarten class is
|
4
4
|
responsible for.
|
5
5
|
|
6
|
-
The kindergarten class is learning about growing plants. The
|
6
|
+
The kindergarten class is learning about growing plants. The teacher
|
7
7
|
thought it would be a good idea to give them actual seeds, plant them in
|
8
8
|
actual dirt, and grow actual plants.
|
9
9
|
|
10
10
|
They've chosen to grow grass, clover, radishes, and violets.
|
11
11
|
|
12
|
-
To this end,
|
13
|
-
|
14
|
-
|
12
|
+
To this end, the children have put little cups along the window sills, and
|
13
|
+
planted one type of plant in each cup, choosing randomly from the available
|
14
|
+
types of seeds.
|
15
15
|
|
16
|
-
```
|
16
|
+
```text
|
17
17
|
[window][window][window]
|
18
|
-
........................ # each dot represents a
|
18
|
+
........................ # each dot represents a cup
|
19
19
|
........................
|
20
20
|
```
|
21
21
|
|
@@ -25,27 +25,27 @@ There are 12 children in the class:
|
|
25
25
|
- Eve, Fred, Ginny, Harriet,
|
26
26
|
- Ileana, Joseph, Kincaid, and Larry.
|
27
27
|
|
28
|
-
Each child gets 4 cups, two on each row.
|
29
|
-
|
28
|
+
Each child gets 4 cups, two on each row. Their teacher assigns cups to
|
29
|
+
the children alphabetically by their names.
|
30
30
|
|
31
31
|
The following diagram represents Alice's plants:
|
32
32
|
|
33
|
-
```
|
33
|
+
```text
|
34
34
|
[window][window][window]
|
35
35
|
VR......................
|
36
36
|
RG......................
|
37
37
|
```
|
38
38
|
|
39
|
-
|
40
|
-
row
|
39
|
+
In the first row, nearest the windows, she has a violet and a radish. In the
|
40
|
+
second row she has a radish and some grass.
|
41
41
|
|
42
42
|
Your program will be given the plants from left-to-right starting with
|
43
43
|
the row nearest the windows. From this, it should be able to determine
|
44
|
-
which plants belong to
|
44
|
+
which plants belong to each student.
|
45
45
|
|
46
46
|
For example, if it's told that the garden looks like so:
|
47
47
|
|
48
|
-
```
|
48
|
+
```text
|
49
49
|
[window][window][window]
|
50
50
|
VRCGVVRVCGGCCGVRGCVCGCGV
|
51
51
|
VRCCCGCRRGVCGCRVVCVGCGCV
|
@@ -59,13 +59,12 @@ While asking for Bob's plants would yield:
|
|
59
59
|
|
60
60
|
- Clover, grass, clover, clover
|
61
61
|
|
62
|
-
|
62
|
+
## Submitting Exercises
|
63
63
|
|
64
64
|
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
65
65
|
|
66
66
|
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`.
|
67
67
|
|
68
|
-
|
69
68
|
For more detailed information about running tests, code style and linting,
|
70
69
|
please see the [help page](http://exercism.io/languages/python).
|
71
70
|
|