Skip to content

Instantly share code, notes, and snippets.

@sbehrens
Created September 6, 2014 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbehrens/caf82b5af9bb7ea499ec to your computer and use it in GitHub Desktop.
Save sbehrens/caf82b5af9bb7ea499ec to your computer and use it in GitHub Desktop.
Playing around with money problem
import itertools
from sys import exit
any_digits = [1.67, 1.98, 1.98, 4.41, 4.41, 4.41, 4.41, 4.41, 5.44, 36, 36, 36, 36, 36, 36, 36, 36, 100, 100]
for L in range(0, len(any_digits)+1):
for subset in itertools.combinations(any_digits, L):
print '%.2f' % sum(subset)
if '%.2f' % sum(subset) == 241.40:
print 'found it!'
print subset
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment