Skip to content

Commit

Permalink
use Fraction for exactness
Browse files Browse the repository at this point in the history
  • Loading branch information
darius committed Jul 12, 2016
1 parent 88b1af5 commit debf65a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion misc/17.py
Expand Up @@ -5,10 +5,11 @@
"""

from __future__ import division
from fractions import Fraction
from itertools import product

def puzzle(target, nums):
for e in exprs_over(tuple(nums)):
for e in exprs_over(tuple(Fraction(n, 1) for n in nums)):
try:
v = eval(e)
except ZeroDivisionError:
Expand Down

0 comments on commit debf65a

Please sign in to comment.