Foundation · Coding exercise
Mask a reference number
strings · boundaries
Guest practice stays in this visit. Sign in to save your progress. Checks cover the stated cases; discussion rubrics are self-reviewed. These tasks do not mark course lessons complete.
DrillMask a reference number
Implement mask(text, keep=4). Preserve the final keep characters and replace earlier characters with *. For keep <= 0, mask every character. If keep exceeds the length, preserve the whole text. Inputs are strings and integers.