The problem with ``int(filter(str.isdigit, operator))`` is that it silently filters out unwanted characters (``1a5``).

I'd recommend ``factor = int(operator[1:])``