My solution:
def is_valid_zip(zip_code):
"""Returns whether the input string is a valid (5 digit) zip code
"""
zip_len= len(zip_code)
for l in zip_code:
if l.isdigit() == False:
return False
if zip_len == 5:
return True
return False
VS suggested :
def is_valid_zip(zip_code):
return len(zip_code) == 5 and zip_code.isdigit()