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.
Files changed (274) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/nth-prime/canonical-data.json +2 -7
  4. data/problem-specifications/exercises/zebra-puzzle/canonical-data.json +16 -0
  5. data/tracks/c/config.json +11 -1
  6. data/tracks/c/docs/C_STYLE_GUIDE.md +142 -0
  7. data/tracks/c/exercises/collatz-conjecture/README.md +65 -0
  8. data/tracks/c/exercises/collatz-conjecture/makefile +15 -0
  9. data/tracks/c/exercises/collatz-conjecture/src/collatz_conjecture.h +8 -0
  10. data/tracks/c/exercises/collatz-conjecture/src/example.c +23 -0
  11. data/tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c +48 -0
  12. data/tracks/c/exercises/collatz-conjecture/test/vendor/unity.c +1300 -0
  13. data/tracks/c/exercises/collatz-conjecture/test/vendor/unity.h +274 -0
  14. data/tracks/c/exercises/collatz-conjecture/test/vendor/unity_internals.h +701 -0
  15. data/tracks/cfml/tasks/GenerateReadme.cfc +5 -5
  16. data/tracks/erlang/testgen/src/testgen.erl +99 -17
  17. data/tracks/erlang/testgen/src/tg_file_tools.erl +3 -3
  18. data/tracks/erlang/testgen/src/tgen.erl +15 -7
  19. data/tracks/haskell/config.json +15 -3
  20. data/tracks/java/scripts/canonical_data_check.sh +1 -1
  21. data/tracks/javascript/config.json +12 -0
  22. data/tracks/javascript/exercises/difference-of-squares/README.md +1 -1
  23. data/tracks/javascript/exercises/sum-of-multiples/README.md +1 -1
  24. data/tracks/javascript/exercises/zipper/README.md +55 -0
  25. data/tracks/javascript/exercises/zipper/example.js +100 -0
  26. data/tracks/javascript/exercises/zipper/zipper.spec.js +77 -0
  27. data/tracks/julia/config.json +12 -0
  28. data/tracks/julia/exercises/triangle/README.md +30 -0
  29. data/tracks/julia/exercises/triangle/example.jl +25 -0
  30. data/tracks/julia/exercises/triangle/runtests.jl +64 -0
  31. data/tracks/julia/exercises/triangle/triangle.jl +8 -0
  32. data/tracks/kotlin/exercises/leap/.meta/version +1 -1
  33. data/tracks/kotlin/exercises/leap/src/test/kotlin/LeapTest.kt +1 -1
  34. data/tracks/kotlin/scripts/canonical_data_check.sh +1 -1
  35. data/tracks/perl6/bin/README.md +1 -4
  36. data/tracks/perl6/bin/exercise-gen.pl6 +3 -4
  37. data/tracks/perl6/exercises/accumulate/example.yaml +2 -2
  38. data/tracks/perl6/exercises/all-your-base/example.yaml +9 -9
  39. data/tracks/perl6/exercises/allergies/example.yaml +7 -7
  40. data/tracks/perl6/exercises/anagram/example.yaml +3 -3
  41. data/tracks/perl6/exercises/atbash-cipher/example.yaml +3 -3
  42. data/tracks/perl6/exercises/bob/example.yaml +4 -4
  43. data/tracks/perl6/exercises/clock/example.yaml +6 -6
  44. data/tracks/perl6/exercises/flatten-array/example.yaml +4 -4
  45. data/tracks/perl6/exercises/grade-school/example.yaml +6 -6
  46. data/tracks/perl6/exercises/grains/example.yaml +3 -3
  47. data/tracks/perl6/exercises/hello-world/example.yaml +5 -5
  48. data/tracks/perl6/exercises/leap/example.yaml +4 -4
  49. data/tracks/perl6/exercises/linked-list/example.yaml +14 -14
  50. data/tracks/perl6/exercises/luhn/example.yaml +3 -3
  51. data/tracks/perl6/exercises/phone-number/example.yaml +3 -3
  52. data/tracks/perl6/exercises/raindrops/example.yaml +3 -3
  53. data/tracks/perl6/exercises/rna-transcription/example.yaml +3 -3
  54. data/tracks/perl6/exercises/robot-name/example.yaml +8 -8
  55. data/tracks/perl6/exercises/scrabble-score/example.yaml +3 -3
  56. data/tracks/perl6/exercises/space-age/example.yaml +8 -8
  57. data/tracks/perl6/exercises/word-count/example.yaml +3 -3
  58. data/tracks/perl6/exercises/wordy/example.yaml +3 -3
  59. data/tracks/python/config.json +14 -0
  60. data/tracks/python/config/maintainers.json +30 -0
  61. data/tracks/python/docs/EXERCISE_README_INSERT.md +1 -2
  62. data/tracks/python/exercises/accumulate/README.md +1 -5
  63. data/tracks/python/exercises/acronym/README.md +1 -3
  64. data/tracks/python/exercises/all-your-base/README.md +2 -3
  65. data/tracks/python/exercises/all-your-base/all_your_base_test.py +13 -13
  66. data/tracks/python/exercises/allergies/README.md +1 -3
  67. data/tracks/python/exercises/alphametics/README.md +3 -4
  68. data/tracks/python/exercises/anagram/README.md +1 -2
  69. data/tracks/python/exercises/atbash-cipher/README.md +3 -3
  70. data/tracks/python/exercises/beer-song/README.md +2 -3
  71. data/tracks/python/exercises/binary-search/README.md +1 -2
  72. data/tracks/python/exercises/binary/README.md +3 -2
  73. data/tracks/python/exercises/bob/README.md +1 -2
  74. data/tracks/python/exercises/book-store/README.md +6 -7
  75. data/tracks/python/exercises/bracket-push/README.md +1 -2
  76. data/tracks/python/exercises/change/README.md +2 -3
  77. data/tracks/python/exercises/circular-buffer/README.md +14 -8
  78. data/tracks/python/exercises/clock/README.md +1 -2
  79. data/tracks/python/exercises/clock/clock_test.py +2 -0
  80. data/tracks/python/exercises/collatz-conjecture/.meta/hints.md +3 -0
  81. data/tracks/python/exercises/collatz-conjecture/README.md +6 -19
  82. data/tracks/python/exercises/complex-numbers/README.md +28 -2
  83. data/tracks/python/exercises/crypto-square/README.md +11 -10
  84. data/tracks/python/exercises/diamond/README.md +7 -8
  85. data/tracks/python/exercises/difference-of-squares/README.md +1 -2
  86. data/tracks/python/exercises/diffie-hellman/.meta/hints.md +1 -1
  87. data/tracks/python/exercises/diffie-hellman/README.md +3 -2
  88. data/tracks/python/exercises/error-handling/.meta/hints.md +8 -0
  89. data/tracks/python/exercises/error-handling/README.md +10 -2
  90. data/tracks/python/exercises/error-handling/error_handling_test.py +15 -3
  91. data/tracks/python/exercises/etl/README.md +3 -2
  92. data/tracks/python/exercises/flatten-array/README.md +2 -4
  93. data/tracks/python/exercises/food-chain/README.md +3 -4
  94. data/tracks/python/exercises/forth/README.md +2 -6
  95. data/tracks/python/exercises/gigasecond/README.md +1 -2
  96. data/tracks/python/exercises/grade-school/README.md +1 -3
  97. data/tracks/python/exercises/grains/README.md +1 -3
  98. data/tracks/python/exercises/grep/README.md +13 -14
  99. data/tracks/python/exercises/hamming/README.md +1 -2
  100. data/tracks/python/exercises/hamming/hamming_test.py +6 -6
  101. data/tracks/python/exercises/hello-world/README.md +1 -2
  102. data/tracks/python/exercises/hexadecimal/README.md +1 -2
  103. data/tracks/python/exercises/hexadecimal/example.py +6 -6
  104. data/tracks/python/exercises/house/README.md +2 -4
  105. data/tracks/python/exercises/isogram/README.md +3 -3
  106. data/tracks/python/exercises/kindergarten-garden/README.md +14 -15
  107. data/tracks/python/exercises/largest-series-product/README.md +1 -2
  108. data/tracks/python/exercises/leap/README.md +2 -3
  109. data/tracks/python/exercises/linked-list/README.md +11 -12
  110. data/tracks/python/exercises/list-ops/README.md +1 -2
  111. data/tracks/python/exercises/luhn/README.md +8 -9
  112. data/tracks/python/exercises/markdown/README.md +1 -6
  113. data/tracks/python/exercises/matrix/README.md +7 -6
  114. data/tracks/python/exercises/meetup/README.md +2 -4
  115. data/tracks/python/exercises/minesweeper/README.md +1 -2
  116. data/tracks/python/exercises/nth-prime/README.md +1 -2
  117. data/tracks/python/exercises/nucleotide-count/README.md +9 -24
  118. data/tracks/python/exercises/ocr-numbers/README.md +6 -7
  119. data/tracks/python/exercises/octal/README.md +7 -4
  120. data/tracks/python/exercises/palindrome-products/README.md +16 -18
  121. data/tracks/python/exercises/pangram/README.md +2 -3
  122. data/tracks/python/exercises/pascals-triangle/README.md +2 -3
  123. data/tracks/python/exercises/perfect-numbers/README.md +3 -4
  124. data/tracks/python/exercises/phone-number/README.md +4 -4
  125. data/tracks/python/exercises/pig-latin/README.md +1 -2
  126. data/tracks/python/exercises/point-mutations/README.md +1 -2
  127. data/tracks/python/exercises/poker/README.md +1 -2
  128. data/tracks/python/exercises/prime-factors/README.md +1 -2
  129. data/tracks/python/exercises/protein-translation/README.md +5 -7
  130. data/tracks/python/exercises/proverb/README.md +12 -11
  131. data/tracks/python/exercises/pythagorean-triplet/README.md +4 -5
  132. data/tracks/python/exercises/queen-attack/README.md +2 -3
  133. data/tracks/python/exercises/rail-fence-cipher/README.md +13 -9
  134. data/tracks/python/exercises/raindrops/README.md +1 -2
  135. data/tracks/python/exercises/rectangles/README.md +8 -9
  136. data/tracks/python/exercises/rectangles/example.py +3 -3
  137. data/tracks/python/exercises/rna-transcription/README.md +1 -2
  138. data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +4 -3
  139. data/tracks/python/exercises/robot-name/README.md +1 -2
  140. data/tracks/python/exercises/robot-simulator/README.md +1 -2
  141. data/tracks/python/exercises/roman-numerals/README.md +2 -3
  142. data/tracks/python/exercises/rotational-cipher/README.md +3 -3
  143. data/tracks/python/exercises/run-length-encoding/README.md +5 -6
  144. data/tracks/python/exercises/run-length-encoding/example.py +2 -2
  145. data/tracks/python/exercises/saddle-points/README.md +2 -3
  146. data/tracks/python/exercises/say/README.md +1 -2
  147. data/tracks/python/exercises/scale-generator/README.md +1 -3
  148. data/tracks/python/exercises/scrabble-score/README.md +4 -3
  149. data/tracks/python/exercises/secret-handshake/README.md +2 -3
  150. data/tracks/python/exercises/series/README.md +1 -2
  151. data/tracks/python/exercises/sieve/README.md +1 -2
  152. data/tracks/python/exercises/simple-cipher/README.md +3 -4
  153. data/tracks/python/exercises/space-age/README.md +2 -3
  154. data/tracks/python/exercises/space-age/space_age_test.py +18 -29
  155. data/tracks/python/exercises/strain/README.md +1 -2
  156. data/tracks/python/exercises/sublist/README.md +1 -2
  157. data/tracks/python/exercises/sum-of-multiples/README.md +1 -5
  158. data/tracks/python/exercises/tournament/README.md +6 -7
  159. data/tracks/python/exercises/transpose/README.md +8 -9
  160. data/tracks/python/exercises/tree-building/README.md +25 -0
  161. data/tracks/python/exercises/tree-building/example.py +46 -0
  162. data/tracks/python/exercises/tree-building/tree_building.py +50 -0
  163. data/tracks/python/exercises/tree-building/tree_building_test.py +183 -0
  164. data/tracks/python/exercises/triangle/README.md +10 -8
  165. data/tracks/python/exercises/trinary/README.md +2 -3
  166. data/tracks/python/exercises/twelve-days/README.md +2 -3
  167. data/tracks/python/exercises/two-bucket/README.md +4 -5
  168. data/tracks/python/exercises/two-bucket/two_bucket_test.py +2 -0
  169. data/tracks/python/exercises/two-fer/README.md +4 -5
  170. data/tracks/python/exercises/two-fer/two_fer_test.py +5 -2
  171. data/tracks/python/exercises/variable-length-quantity/README.md +7 -9
  172. data/tracks/python/exercises/word-count/README.md +2 -4
  173. data/tracks/python/exercises/word-search/README.md +2 -3
  174. data/tracks/python/exercises/wordy/README.md +1 -7
  175. data/tracks/python/exercises/wordy/example.py +8 -8
  176. data/tracks/python/exercises/wordy/wordy_test.py +36 -32
  177. data/tracks/python/exercises/zebra-puzzle/README.md +1 -2
  178. data/tracks/python/requirements-travis.txt +1 -1
  179. data/tracks/ruby/config.json +11 -0
  180. data/tracks/ruby/docs/TESTS.md +6 -0
  181. data/tracks/ruby/exercises/pangram/.meta/.version +1 -1
  182. data/tracks/ruby/exercises/pangram/.meta/solutions/pangram.rb +1 -1
  183. data/tracks/ruby/exercises/pangram/pangram_test.rb +11 -4
  184. data/tracks/ruby/exercises/two-fer/.meta/.version +1 -0
  185. data/tracks/ruby/exercises/two-fer/.meta/generator/two_fer_case.rb +12 -0
  186. data/tracks/ruby/exercises/two-fer/.meta/solutions/two_fer.rb +9 -0
  187. data/tracks/ruby/exercises/two-fer/README.md +69 -0
  188. data/tracks/ruby/exercises/two-fer/two_fer_test.rb +42 -0
  189. data/tracks/rust/config.json +12 -0
  190. data/tracks/rust/exercises/binary-search/.meta/hints.md +38 -0
  191. data/tracks/rust/exercises/binary-search/Cargo.lock +4 -0
  192. data/tracks/rust/exercises/binary-search/Cargo.toml +6 -0
  193. data/tracks/rust/exercises/binary-search/README.md +113 -0
  194. data/tracks/rust/exercises/binary-search/example.rs +29 -0
  195. data/tracks/rust/exercises/binary-search/src/lib.rs +0 -0
  196. data/tracks/rust/exercises/binary-search/tests/binary-search.rs +96 -0
  197. data/tracks/typescript/common/package.json +6 -6
  198. data/tracks/typescript/common/yarn.lock +929 -610
  199. data/tracks/typescript/exercises/acronym/package.json +6 -6
  200. data/tracks/typescript/exercises/acronym/yarn.lock +929 -610
  201. data/tracks/typescript/exercises/anagram/package.json +6 -6
  202. data/tracks/typescript/exercises/anagram/yarn.lock +929 -610
  203. data/tracks/typescript/exercises/beer-song/package.json +6 -6
  204. data/tracks/typescript/exercises/beer-song/yarn.lock +929 -610
  205. data/tracks/typescript/exercises/binary-search-tree/package.json +6 -6
  206. data/tracks/typescript/exercises/binary-search-tree/yarn.lock +929 -610
  207. data/tracks/typescript/exercises/binary-search/package.json +6 -6
  208. data/tracks/typescript/exercises/binary-search/yarn.lock +929 -610
  209. data/tracks/typescript/exercises/bob/package.json +6 -6
  210. data/tracks/typescript/exercises/bob/yarn.lock +929 -610
  211. data/tracks/typescript/exercises/circular-buffer/package.json +6 -6
  212. data/tracks/typescript/exercises/circular-buffer/yarn.lock +929 -610
  213. data/tracks/typescript/exercises/clock/package.json +6 -6
  214. data/tracks/typescript/exercises/clock/yarn.lock +929 -610
  215. data/tracks/typescript/exercises/difference-of-squares/package.json +6 -6
  216. data/tracks/typescript/exercises/difference-of-squares/yarn.lock +929 -610
  217. data/tracks/typescript/exercises/etl/package.json +6 -6
  218. data/tracks/typescript/exercises/etl/yarn.lock +929 -610
  219. data/tracks/typescript/exercises/food-chain/package.json +6 -6
  220. data/tracks/typescript/exercises/food-chain/yarn.lock +929 -610
  221. data/tracks/typescript/exercises/gigasecond/package.json +6 -6
  222. data/tracks/typescript/exercises/gigasecond/yarn.lock +929 -610
  223. data/tracks/typescript/exercises/grade-school/package.json +6 -6
  224. data/tracks/typescript/exercises/grade-school/yarn.lock +929 -610
  225. data/tracks/typescript/exercises/hamming/package.json +6 -6
  226. data/tracks/typescript/exercises/hamming/yarn.lock +929 -610
  227. data/tracks/typescript/exercises/hello-world/README.md +354 -0
  228. data/tracks/typescript/exercises/hello-world/package.json +6 -6
  229. data/tracks/typescript/exercises/hello-world/yarn.lock +929 -610
  230. data/tracks/typescript/exercises/largest-series-product/package.json +6 -6
  231. data/tracks/typescript/exercises/largest-series-product/yarn.lock +929 -610
  232. data/tracks/typescript/exercises/leap/package.json +6 -6
  233. data/tracks/typescript/exercises/leap/yarn.lock +929 -610
  234. data/tracks/typescript/exercises/linked-list/package.json +6 -6
  235. data/tracks/typescript/exercises/linked-list/yarn.lock +929 -610
  236. data/tracks/typescript/exercises/nth-prime/package.json +6 -6
  237. data/tracks/typescript/exercises/nth-prime/yarn.lock +929 -610
  238. data/tracks/typescript/exercises/pangram/package.json +6 -6
  239. data/tracks/typescript/exercises/pangram/yarn.lock +929 -610
  240. data/tracks/typescript/exercises/pascals-triangle/package.json +6 -6
  241. data/tracks/typescript/exercises/pascals-triangle/yarn.lock +929 -610
  242. data/tracks/typescript/exercises/phone-number/package.json +6 -6
  243. data/tracks/typescript/exercises/phone-number/yarn.lock +929 -610
  244. data/tracks/typescript/exercises/prime-factors/package.json +6 -6
  245. data/tracks/typescript/exercises/prime-factors/yarn.lock +929 -610
  246. data/tracks/typescript/exercises/raindrops/package.json +6 -6
  247. data/tracks/typescript/exercises/raindrops/yarn.lock +929 -610
  248. data/tracks/typescript/exercises/rna-transcription/package.json +6 -6
  249. data/tracks/typescript/exercises/rna-transcription/yarn.lock +929 -610
  250. data/tracks/typescript/exercises/robot-name/package.json +6 -6
  251. data/tracks/typescript/exercises/robot-name/yarn.lock +929 -610
  252. data/tracks/typescript/exercises/robot-simulator/package.json +6 -6
  253. data/tracks/typescript/exercises/robot-simulator/yarn.lock +929 -610
  254. data/tracks/typescript/exercises/rotational-cipher/package.json +6 -6
  255. data/tracks/typescript/exercises/rotational-cipher/yarn.lock +929 -610
  256. data/tracks/typescript/exercises/say/package.json +6 -6
  257. data/tracks/typescript/exercises/say/yarn.lock +929 -610
  258. data/tracks/typescript/exercises/scrabble-score/package.json +6 -6
  259. data/tracks/typescript/exercises/scrabble-score/yarn.lock +929 -610
  260. data/tracks/typescript/exercises/series/package.json +6 -6
  261. data/tracks/typescript/exercises/series/yarn.lock +929 -610
  262. data/tracks/typescript/exercises/space-age/package.json +6 -6
  263. data/tracks/typescript/exercises/space-age/yarn.lock +929 -610
  264. data/tracks/typescript/exercises/strain/package.json +6 -6
  265. data/tracks/typescript/exercises/strain/yarn.lock +929 -610
  266. data/tracks/typescript/exercises/sum-of-multiples/package.json +6 -6
  267. data/tracks/typescript/exercises/sum-of-multiples/yarn.lock +929 -610
  268. data/tracks/typescript/exercises/triangle/package.json +6 -6
  269. data/tracks/typescript/exercises/triangle/yarn.lock +929 -610
  270. data/tracks/typescript/exercises/word-count/package.json +6 -6
  271. data/tracks/typescript/exercises/word-count/yarn.lock +929 -610
  272. data/tracks/typescript/exercises/wordy/package.json +6 -6
  273. data/tracks/typescript/exercises/wordy/yarn.lock +929 -610
  274. metadata +37 -2
@@ -2,30 +2,32 @@
2
2
 
3
3
  Determine if a triangle is equilateral, isosceles, or scalene.
4
4
 
5
- An _equilateral_ triangle has all three sides the same length.<br/>
5
+ An _equilateral_ triangle has all three sides the same length.
6
+
6
7
  An _isosceles_ triangle has at least two sides the same length. (It is sometimes
7
8
  specified as having exactly two sides the same length, but for the purposes of
8
- this exercise we'll say at least two.)<br/>
9
+ this exercise we'll say at least two.)
10
+
9
11
  A _scalene_ triangle has all sides of different lengths.
10
12
 
11
13
  ## Note
12
14
 
13
- For a shape to be a triangle at all, all sides have to be of length > 0, and
14
- the sum of the lengths of any two sides must be greater than or equal to the
15
+ For a shape to be a triangle at all, all sides have to be of length > 0, and
16
+ the sum of the lengths of any two sides must be greater than or equal to the
15
17
  length of the third side. See [Triangle Inequality](https://en.wikipedia.org/wiki/Triangle_inequality).
16
18
 
17
19
  ## Dig Deeper
18
20
 
19
- The case where the sum of the lengths of two sides _equals_ that of the
20
- third is known as a _degenerate_ triangle - it has zero area and looks like
21
+ The case where the sum of the lengths of two sides _equals_ that of the
22
+ third is known as a _degenerate_ triangle - it has zero area and looks like
21
23
  a single line. Feel free to add your own code/tests to check for degenerate triangles.
22
- ### Submitting Exercises
24
+
25
+ ## Submitting Exercises
23
26
 
24
27
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
25
28
 
26
29
  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`.
27
30
 
28
-
29
31
  For more detailed information about running tests, code style and linting,
30
32
  please see the [help page](http://exercism.io/languages/python).
31
33
 
@@ -11,7 +11,7 @@ Trinary numbers contain three symbols: 0, 1, and 2.
11
11
  The last place in a trinary number is the 1's place. The second to last
12
12
  is the 3's place, the third to last is the 9's place, etc.
13
13
 
14
- ```bash
14
+ ```shell
15
15
  # "102012"
16
16
  1 0 2 0 1 2 # the number
17
17
  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.
21
21
  If your language provides a method in the standard library to perform the
22
22
  conversion, pretend it doesn't exist and implement it yourself.
23
23
 
24
- ### Submitting Exercises
24
+ ## Submitting Exercises
25
25
 
26
26
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
27
27
 
28
28
  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`.
29
29
 
30
-
31
30
  For more detailed information about running tests, code style and linting,
32
31
  please see the [help page](http://exercism.io/languages/python).
33
32
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Output the lyrics to 'The Twelve Days of Christmas'.
4
4
 
5
- ```
5
+ ```text
6
6
  On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.
7
7
 
8
8
  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,
28
28
  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.
29
29
  ```
30
30
 
31
- ### Submitting Exercises
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
 
@@ -4,7 +4,7 @@ Given two buckets of different size, demonstrate how to measure an exact number
4
4
 
5
5
  Since this mathematical problem is fairly subject to interpretation / individual approach, the tests have been written specifically to expect one overarching solution.
6
6
 
7
- To help, the tests provide you with which bucket to fill first. That means, when starting with the larger bucket full, you are NOT allowed at any point to have the smaller bucket full and the larger bucket empty (aka, the opposite starting point); that would defeat the purpose of comparing both approaches!
7
+ To help, the tests provide you with which bucket to fill first. That means, when starting with the larger bucket full, you are NOT allowed at any point to have the smaller bucket full and the larger bucket empty (aka, the opposite starting point); that would defeat the purpose of comparing both approaches!
8
8
 
9
9
  Your program will take as input:
10
10
  - the size of bucket one, passed as a numeric value
@@ -17,9 +17,9 @@ Your program should determine:
17
17
  - which bucket should end up with the desired number of liters (let's say this is bucket A) - expects a String (either 'one' or 'two')
18
18
  - how many liters are left in the other bucket (bucket B) - expects a numeric value
19
19
 
20
- Note: any time a change is made to either or both buckets counts as one (1) move.
20
+ Note: any time a change is made to either or both buckets counts as one (1) move.
21
21
 
22
- Example:
22
+ Example:
23
23
  Bucket one can hold up to 7 liters, and bucket two can hold up to 11 liters. Let's say bucket one, at a given step, is holding 7 liters, and bucket two is holding 8 liters (7,8). If you empty bucket one and make no change to bucket two, leaving you with 0 liters and 8 liters respectively (0,8), that counts as one "move". Instead, if you had poured from bucket one into bucket two until bucket two was full, leaving you with 4 liters in bucket one and 11 liters in bucket two (4,11), that would count as only one "move" as well.
24
24
 
25
25
  To conclude, the only valid moves are:
@@ -29,13 +29,12 @@ To conclude, the only valid moves are:
29
29
 
30
30
  Written with <3 at [Fullstack Academy](http://www.fullstackacademy.com/) by [Lindsay](http://lindsaylevine.com).
31
31
 
32
- ### Submitting Exercises
32
+ ## Submitting Exercises
33
33
 
34
34
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
35
35
 
36
36
  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
37
 
38
-
39
38
  For more detailed information about running tests, code style and linting,
40
39
  please see the [help page](http://exercism.io/languages/python).
41
40
 
@@ -8,6 +8,8 @@ import unittest
8
8
  from two_bucket import two_bucket
9
9
 
10
10
 
11
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0
12
+
11
13
  class TwoBucketTest(unittest.TestCase):
12
14
  def test_bucket_one_size_3_bucket_two_size_5_start_with_bucket_one(self):
13
15
  self.assertEqual(two_bucket(3, 5, 1, "one"), (4, "one", 5))
@@ -1,8 +1,8 @@
1
- # Two-fer
1
+ # Two Fer
2
2
 
3
3
  `Two-fer` or `2-fer` is short for two for one. One for you and one for me.
4
4
 
5
- ```
5
+ ```text
6
6
  "One for X, one for me."
7
7
  ```
8
8
 
@@ -11,13 +11,12 @@ When X is a name or "you".
11
11
  If the given name is "Alice", the result should be "One for Alice, one for me."
12
12
  If no name is given, the result should be "One for you, one for me."
13
13
 
14
- ### Submitting Exercises
14
+ ## Submitting Exercises
15
15
 
16
16
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
17
17
 
18
18
  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
19
 
20
-
21
20
  For more detailed information about running tests, code style and linting,
22
21
  please see the [help page](http://exercism.io/languages/python).
23
22
 
@@ -26,4 +25,4 @@ please see the [help page](http://exercism.io/languages/python).
26
25
  This is an exercise to introduce users to basic programming constructs, just after hello World. [https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
27
26
 
28
27
  ## Submitting Incomplete Solutions
29
- It's possible to submit an incomplete solution so you can see how others have completed the exercise.
28
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -2,13 +2,16 @@ import unittest
2
2
 
3
3
  import two_fer
4
4
 
5
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
6
+
5
7
 
6
8
  class Two_Fer_test(unittest.TestCase):
7
9
  def test_empty(self):
8
10
  self.assertEqual(two_fer.two_fer(), 'One for you, one for me.')
9
11
 
10
- def test_eve(self):
11
- self.assertEqual(two_fer.two_fer("Eve"), "One for Eve, one for me.")
12
+ def test_alice(self):
13
+ self.assertEqual(two_fer.two_fer("Alice"),
14
+ "One for Alice, one for me.")
12
15
 
13
16
  def test_bob(self):
14
17
  self.assertEqual(two_fer.two_fer("Bob"), "One for Bob, one for me.")
@@ -5,18 +5,17 @@ Implement variable length quantity encoding and decoding.
5
5
  The goal of this exercise is to implement [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) encoding/decoding.
6
6
 
7
7
  In short, the goal of this encoding is to encode integer values in a way that would save bytes.
8
- Only the first 7 bits of each byte is significant (right-justified; sort of like an ASCII byte).
9
- So, if you have a 32-bit value, you have to unpack it into a series of 7-bit bytes.
10
- Of course, you will have a variable number of bytes depending upon your integer.
8
+ Only the first 7 bits of each byte is significant (right-justified; sort of like an ASCII byte).
9
+ So, if you have a 32-bit value, you have to unpack it into a series of 7-bit bytes.
10
+ Of course, you will have a variable number of bytes depending upon your integer.
11
11
  To indicate which is the last byte of the series, you leave bit #7 clear.
12
- In all of the preceding bytes, you set bit #7.
12
+ In all of the preceding bytes, you set bit #7.
13
13
 
14
- So, if an integer is between `0-127`, it can be represented as one byte.
14
+ So, if an integer is between `0-127`, it can be represented as one byte.
15
15
  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.
16
16
  Here are examples of integers as 32-bit values, and the variable length quantities that they translate to:
17
17
 
18
-
19
- ```
18
+ ```text
20
19
  NUMBER VARIABLE QUANTITY
21
20
  00000000 00
22
21
  00000040 40
@@ -32,13 +31,12 @@ Here are examples of integers as 32-bit values, and the variable length quantiti
32
31
  0FFFFFFF FF FF FF 7F
33
32
  ```
34
33
 
35
- ### Submitting Exercises
34
+ ## Submitting Exercises
36
35
 
37
36
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
38
37
 
39
38
  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`.
40
39
 
41
-
42
40
  For more detailed information about running tests, code style and linting,
43
41
  please see the [help page](http://exercism.io/languages/python).
44
42
 
@@ -4,21 +4,19 @@ Given a phrase, count the occurrences of each word in that phrase.
4
4
 
5
5
  For example for the input `"olly olly in come free"`
6
6
 
7
- ```plain
7
+ ```text
8
8
  olly: 2
9
9
  in: 1
10
10
  come: 1
11
11
  free: 1
12
12
  ```
13
13
 
14
-
15
- ### Submitting Exercises
14
+ ## Submitting Exercises
16
15
 
17
16
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
18
17
 
19
18
  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
19
 
21
-
22
20
  For more detailed information about running tests, code style and linting,
23
21
  please see the [help page](http://exercism.io/languages/python).
24
22
 
@@ -5,7 +5,7 @@ words in them.
5
5
 
6
6
  For example:
7
7
 
8
- ```
8
+ ```text
9
9
  jefblpepre
10
10
  camdcimgtc
11
11
  oivokprjsm
@@ -26,13 +26,12 @@ vertical and diagonal.
26
26
  Given a puzzle and a list of words return the location of the first and last
27
27
  letter of each word.
28
28
 
29
- ### Submitting Exercises
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
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  Parse and evaluate simple math word problems returning the answer as an integer.
4
4
 
5
-
6
5
  ## Iteration 1 — Addition
7
6
 
8
7
  Add two numbers together.
@@ -13,7 +12,6 @@ Evaluates to 18.
13
12
 
14
13
  Handle large numbers and negative numbers.
15
14
 
16
-
17
15
  ## Iteration 2 — Subtraction, Multiplication and Division
18
16
 
19
17
  Now, perform the other three operations.
@@ -30,7 +28,6 @@ Now, perform the other three operations.
30
28
 
31
29
  5
32
30
 
33
-
34
31
  ## Iteration 3 — Multiple Operations
35
32
 
36
33
  Handle a set of operations, in sequence.
@@ -46,7 +43,6 @@ left-to-right, _ignoring the typical order of operations._
46
43
 
47
44
  15 (i.e. not 9)
48
45
 
49
-
50
46
  ## Bonus — Exponentials
51
47
 
52
48
  If you'd like, handle exponentials.
@@ -55,14 +51,12 @@ If you'd like, handle exponentials.
55
51
 
56
52
  32
57
53
 
58
-
59
- ### Submitting Exercises
54
+ ## Submitting Exercises
60
55
 
61
56
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
62
57
 
63
58
  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
59
 
65
-
66
60
  For more detailed information about running tests, code style and linting,
67
61
  please see the [help page](http://exercism.io/languages/python).
68
62
 
@@ -14,19 +14,19 @@ VALID_OPERATIONS = {"plus": add, "minus": sub,
14
14
  def calculate(stmt):
15
15
  if not (stmt.startswith("What is ") and stmt.endswith("?")):
16
16
  raise ValueError("Ill-formed question")
17
- l = stmt[8:-1].strip().lower().split()
18
- if not l:
17
+ words = stmt[8:-1].strip().lower().split()
18
+ if not words:
19
19
  raise ValueError("Ill-formed question")
20
- l.reverse()
20
+ words.reverse()
21
21
  try:
22
- op1 = int(l.pop())
22
+ op1 = int(words.pop())
23
23
  except ValueError:
24
24
  raise ValueError("Ill-formed question")
25
- while l:
26
- oprt = [l.pop()]
27
- while l:
25
+ while words:
26
+ oprt = [words.pop()]
27
+ while words:
28
28
  try:
29
- next_tk = l.pop()
29
+ next_tk = words.pop()
30
30
  op2 = int(next_tk)
31
31
  break
32
32
  except ValueError:
@@ -3,54 +3,62 @@ import unittest
3
3
  from wordy import calculate
4
4
 
5
5
 
6
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
7
+
6
8
  class WordyTest(unittest.TestCase):
7
- def test_simple_add_1(self):
8
- self.assertEqual(calculate("What is 5 plus 13?"), 18)
9
+ def test_addition(self):
10
+ self.assertEqual(calculate("What is 1 plus 1?"), 2)
9
11
 
10
- def test_simple_add_2(self):
11
- self.assertEqual(calculate("What is 5 plus -13?"), -8)
12
+ def test_more_addition(self):
13
+ self.assertEqual(calculate("What is 53 plus 2?"), 55)
12
14
 
13
- def test_simple_sub_1(self):
14
- self.assertEqual(calculate("What is 103 minus 97?"), 6)
15
+ def test_addition_with_negative_numbers(self):
16
+ self.assertEqual(calculate("What is -1 plus -10?"), -11)
15
17
 
16
- def test_simple_sub_2(self):
17
- self.assertEqual(calculate("What is 97 minus 103?"), -6)
18
+ def test_large_addition(self):
19
+ self.assertEqual(calculate("What is 123 plus 45678?"), 45801)
18
20
 
19
- def test_simple_mult(self):
20
- self.assertEqual(calculate("What is 7 multiplied by 3?"), 21)
21
+ def test_subtraction(self):
22
+ self.assertEqual(calculate("What is 4 minus -12?"), 16)
21
23
 
22
- def test_simple_div(self):
23
- self.assertEqual(calculate("What is 45 divided by 5?"), 9)
24
+ def test_multiplication(self):
25
+ self.assertEqual(calculate("What is -3 multiplied by 25?"), -75)
24
26
 
25
- def test_add_negative_numbers(self):
26
- self.assertEqual(calculate("What is -1 plus -10?"), -11)
27
+ def test_division(self):
28
+ self.assertEqual(calculate("What is 33 divided by -3?"), -11)
27
29
 
28
- def test_add_more_digits(self):
29
- self.assertEqual(calculate("What is 123 plus 45678?"), 45801)
30
+ def test_multiple_addition(self):
31
+ self.assertEqual(calculate("What is 1 plus 1 plus 1?"), 3)
30
32
 
31
- def test_add_twice(self):
32
- self.assertEqual(calculate("What is 1 plus 2 plus 1?"), 4)
33
+ def test_addition_then_subtraction(self):
34
+ self.assertEqual(calculate("What is 1 plus 5 minus -2?"), 8)
33
35
 
34
- def test_add_then_subtract(self):
35
- self.assertEqual(calculate("What is 1 plus 5 minus -8?"), 14)
36
+ def test_multiple_subtraction(self):
37
+ self.assertEqual(calculate("What is 20 minus 4 minus 13?"), 3)
36
38
 
37
- def test_subtract_twice(self):
38
- self.assertEqual(calculate("What is 20 minus 14 minus 13?"), -7)
39
+ def test_subtraction_then_addition(self):
40
+ self.assertEqual(calculate("What is 17 minus 6 plus 3?"), 14)
39
41
 
40
- def test_multiply_twice(self):
42
+ def test_multiple_multiplication(self):
41
43
  self.assertEqual(
42
44
  calculate("What is 2 multiplied by -2 multiplied by 3?"), -12)
43
45
 
44
- def test_add_then_multiply(self):
46
+ def test_addition_then_multiplication(self):
45
47
  self.assertEqual(calculate("What is -3 plus 7 multiplied by -2?"), -8)
46
48
 
47
- def test_divide_twice(self):
49
+ def test_multiple_division(self):
48
50
  self.assertEqual(
49
- calculate("What is -12000 divided by 25 divided by -30?"), 16)
51
+ calculate("What is -12 divided by 2 divided by -3?"), 2)
50
52
 
51
- def test_invalid_operation(self):
53
+ def test_unknown_operation(self):
52
54
  with self.assertRaises(ValueError):
53
- calculate("What is 4 xor 7?")
55
+ calculate("What is 52 cubed?")
56
+
57
+ def test_non_math_question(self):
58
+ with self.assertRaises(ValueError):
59
+ calculate("Who is the President of the United States?")
60
+
61
+ # Additional tests for this track
54
62
 
55
63
  def test_missing_operation(self):
56
64
  with self.assertRaises(ValueError):
@@ -60,10 +68,6 @@ class WordyTest(unittest.TestCase):
60
68
  with self.assertRaises(ValueError):
61
69
  calculate("What is 7 plus multiplied by -2?")
62
70
 
63
- def test_irrelevant_question(self):
64
- with self.assertRaises(ValueError):
65
- calculate("Which is greater, 3 or 2?")
66
-
67
71
 
68
72
  if __name__ == '__main__':
69
73
  unittest.main()