Search RU
Tasks / AI / LLM / Masking PII in a response
Statement medium

Masking PII in a response

`redact_pii(text)` masks emails and phone numbers in a model response:

- email → `[email]`;
- phone → `[phone]`;
- the rest of the text is unchanged.

Write tests: email, phone, both at once, safe text. Check that exactly the right
things are masked and nothing extra is touched.

AIprivacyregex
test_solution.py Python 3.14
AI mentor

The AI mentor is available after you log in: it sees your attempt history and does not spend resources on anonymous requests.

Log in and ask
Hints 1 of 3 unlocked · attempts: 0
Hint 1

What exactly counts as PII in this filter? Start with one email and one phone
number.

Hint 2 — unlocks after 1 attempt
Hint 3 — unlocks after 3 attempts