Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
darius committed Jul 13, 2016
1 parent b23b8e4 commit 34f2b51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions misc/17.py
Expand Up @@ -20,7 +20,7 @@ def puzzle(target, nums):

commutative_ops = ('+', '*')
noncommutative_ops = ('-', '/')
both_ops = commutative_ops + noncommutative_ops
all_ops = commutative_ops + noncommutative_ops

def exprs_over(nums):
if len(nums) == 1:
Expand All @@ -29,7 +29,7 @@ def exprs_over(nums):
for L, R in splits(nums):
if not L or not R: continue
for x, y in product(exprs_over(L), exprs_over(R)):
for op in both_ops:
for op in all_ops:
yield '(%s %s %s)' % (x, op, y)
for op in noncommutative_ops:
yield '(%s %s %s)' % (y, op, x)
Expand Down

0 comments on commit 34f2b51

Please sign in to comment.