runtime
203 / 500
question 203 Dates Numbers & Regex · easy

Find the invalid SKU codes

A supplier's price list must use Runtime Market SKUs: three capital letters, a dash and five digits, like HOM-52782. Before importing it, list the codes that don't have exactly that shape.

Functionbad_skus(codes)
Validexactly [A-Z]{3}-\d{5} for the whole code: no spaces, no extra characters before or after
Returnsa new list of the invalid codes, in their original order; [] when all are valid
Examples
callbad_skus(['HOM-52782', 'hom-52782', 'BOO-5841', 'GRO-63674 '])returns['hom-52782', 'BOO-5841', 'GRO-63674 ']
callbad_skus(['HOM-52782', 'ELE-24781'])returns[]
callbad_skus([])returns[]

Loading your progress…

Find the invalid SKU codes — Python practice · Runtime