different solutions for the "zip code validator" challenge
Hi everybody, I solved the "zip code validator" in code coach with this code: code = input() if (len(code) == 5) and (code.count(" ") == 0) and (int(code)/1 == int(code)): print("true") else: print("false") --- I think there are more nice solutions possible - what are your ideas? Here is the task: 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