luhn: update examples to reinforce manipulating from the right#549
luhn: update examples to reinforce manipulating from the right#549
Conversation
|
Related to #547 |
|
|
||
| ``` | ||
| _4_ 4_4 _8_ | ||
| 4_3_ 1_8_ 0_4_ 6_6_ |
|
|
||
| ``` | ||
| 7+2+5+3+2+2+5+2+5+3+1+2+0+5+3+9 = 57 | ||
| 7+2+5+3+2+2+6+2+5+3+1+2+0+5+3+9 = 57 |
There was a problem hiding this comment.
Fixed a typo in this sum!
petertseng
left a comment
There was a problem hiding this comment.
I don't disagree with any change made herein, though now I claim that the commit message is inaccurate. The update to fix a typo is good but it has nothing to do with manipulating from the right, so it would fit in its own commit.
I pondered briefly whether it would be useful to keep some odd-length example in for the purpose of telling the student "double every second from the right doesn't mean you can just start at the leftmost digit" because that doesn't work for odd-length strings. But probably best left to the tests.
544b6ec to
991ef70
Compare
|
@petertseng commit split into two! |
|
I agree on leaving the odd length examples to the tests; seems like the right place to discover that distinction if the (now multiple, consistent) clues from the description weren't enough. |
|
LGTM! |
|
Is there a "minimum number of approvals protocol" within this repo? I'm a little unclear as to when a PR is considered good to merge. Should I be merging this myself now that it has received 2 separate thumbs up? Thanks 🤓 |
rbasso
left a comment
There was a problem hiding this comment.
If there is a minimum number of approvals, it is not bigger then 3! 😄
Is there a "minimum number of approvals protocol" within this repo? I'm a little unclear as to when a PR is considered good to merge. Should I be merging this myself now that it has received 2 separate thumbs up? Thanks 🤓
Carry #549: Add generator for etl
This updates the luhn examples to operate on even-length strings. This reinforces the idea that the numbers to be doubled are counted from the right, not from the left. (The previous odd-length example string did not emphasize this distinction.)