making change more pythonic