As headmaster of the post office, sometimes people write zip codes that don't exist or zip codes that are not valid.
You are tasked with making a system to check if the inputted zip code is a valid zip code.
Write a program that takes in a string representing a zip code. Output true or false if it is a valid zip code or not.
A valid zip code is only numbers, must be 5 characters in length, and contain no spaces.
A string containing a zip code.
A string: true is the input is a valid zip code, or false, if it is not.
752f78
false
A valid zip code contains 5 digits, and no letters or spaces. The input is 6 characters long and contains letters, making it an invalid zip code.
| Language | Solution |
|---|---|
| C | not available |
| CPP | not available |
| C# | not available |
| Python | available |
| Java | not available |
| Ruby | not available |
| Swift | not available |