Beginner
Redact API keys from log lines
Keys look like sk- followed by 8 or more letters or digits. Write mask(key) returning the first 3 characters, ... and the last 4 characters, and redact(text) that replaces every key in text with its masked form.
Text without a key must come back unchanged, and sk- followed by fewer than 8 characters is not a key.
What Check tests
maskkeeps the first 3 and last 4 charactersredactmasks a key inside a sentence- Two keys in one line are both masked
- Text without a key, or with a too-short one, is unchanged
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.