13 lines
407 B
Python
13 lines
407 B
Python
import string
|
|
|
|
|
|
def validate_cat_name(name):
|
|
ALLOWED = set(string.ascii_letters + string.digits)
|
|
|
|
if len(name) < 4 or len(name) > 24:
|
|
return "Your cat's name must be 4-24 characters long."
|
|
if not all(c in ALLOWED for c in name):
|
|
return "Letters and numbers only."
|
|
if not any(c in string.ascii_letters for c in name):
|
|
return "Your cat's name needs at least 1 letter."
|