You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-18 07:07:35 +02:00
Tweaks from student feedback (#1061)
* help students with the luhn exercise * mention method-specific types in speaker notes * Update src/exercises/day-2/luhn.md Co-authored-by: Martin Geisler <martin@geisler.net> --------- Co-authored-by: Martin Geisler <martin@geisler.net>
This commit is contained in:
committed by
GitHub
parent
8956fab9bb
commit
e596b80c03
@ -6,8 +6,8 @@ following to validate the credit card number:
|
||||
|
||||
* Ignore all spaces. Reject number with less than two digits.
|
||||
|
||||
* Moving from right to left, double every second digit: for the number `1234`,
|
||||
we double `3` and `1`.
|
||||
* Moving from **right to left**, double every second digit: for the number `1234`,
|
||||
we double `3` and `1`. For the number `98765`, we double `6` and `8`.
|
||||
|
||||
* After doubling a digit, sum the digits. So doubling `7` becomes `14` which
|
||||
becomes `5`.
|
||||
@ -16,8 +16,10 @@ following to validate the credit card number:
|
||||
|
||||
* The credit card number is valid if the sum ends with `0`.
|
||||
|
||||
Copy the following code to <https://play.rust-lang.org/> and implement the
|
||||
function:
|
||||
Copy the code below to <https://play.rust-lang.org/> and implement the function.
|
||||
|
||||
Try to solve the problem the "simple" way first, using `for` loops and integers.
|
||||
Then, revisit the solution and try to implement it with iterators.
|
||||
|
||||
|
||||
```rust
|
||||
|
Reference in New Issue
Block a user