Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.1 KB

File metadata and controls

38 lines (30 loc) · 1.1 KB

Zip Code Validator

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.

Task

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.

Input Format

A string containing a zip code.

Output Format

A string: true is the input is a valid zip code, or false, if it is not.

Sample Input

752f78

Sample Output

false

Explanation

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.

Solutions

Language Solution
C not available
CPP not available
C# not available
Python available
Java not available
Ruby not available
Swift not available