Objective
Create a Python program that validates postal codes with re.fullmatch.
Instructions
- Read an integer
nand thenncodes, one per line. - A postal code is valid if it is made up of exactly 5 digits:
r"\d{5}". - Use
re.fullmatch, which requires the whole text to match (not just a part of it). - Show
ValidorNot validfor each code, in the same order.
4
28001
2800
280011
2800a
Valid
Not valid
Not valid
Not valid
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise