#if you wanted to allow numbers from 1 to 12 import re input = input("type a number") matches = re.search("^([1-9]|1[0-2])$",input)