Python data engineering interview problem. Difficulty: beginner. Pattern: Strings. About 10 minutes. Part of the Pro drill bank.
Checkout accepts a discount code string. Fraud wants a strict format check before the code is sent to billing, not a fuzzy 'looks ok' guess.
Return whether a discount code matches the required format.
Input: valid_discount_code('SAVE-100') Output: True This input follows the stated rules and produces this output.
Topics: lakebench, python, functions.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Write a function that checks whether a discount code matches a required pattern.
Return whether a discount code matches the required format.