Skip to content

Instantly share code, notes, and snippets.

@orangain
Created February 9, 2011 10:07
Show Gist options
  • Save orangain/818238 to your computer and use it in GitHub Desktop.
Save orangain/818238 to your computer and use it in GitHub Desktop.
#coding: utf-8
from itertools import permutations
operators = ('+', '-', '*', '/', '==')
for ordered_operators in permutations(operators):
equation = '5.%s4.%s3.%s2.%s1.%s0.' % ordered_operators
try:
if eval(equation):
print equation
except ZeroDivisionError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment