Created
September 6, 2014 03:48
-
-
Save sbehrens/caf82b5af9bb7ea499ec to your computer and use it in GitHub Desktop.
Playing around with money problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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