Solution to coin change problem in python