From 3474c07c130e7d7e047aa156da523a01818dd45f Mon Sep 17 00:00:00 2001 From: Nicole L Date: Fri, 25 Apr 2025 03:42:12 -0700 Subject: [PATCH] Explicitly non-digit characters in testing exercise (#2723) Students sometimes ask about this so I figure it'd be good to specify in the text. --- src/testing/exercise.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/testing/exercise.md b/src/testing/exercise.md index c255c770..b50f6d3d 100644 --- a/src/testing/exercise.md +++ b/src/testing/exercise.md @@ -8,7 +8,8 @@ The [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is used to validate credit card numbers. The algorithm takes a string as input and does the following to validate the credit card number: -- Ignore all spaces. Reject numbers with fewer than two digits. +- Ignore all spaces. Reject numbers with fewer than two digits. Reject letters + and other non-digit characters. - 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`.