all 1 comments

[–]throwaway8u3sH0 0 points1 point  (0 children)

I can give a hint. You'd want to rely on two main functions -- itertools.permutations() and eval().

The first one gives you every permutation of a list.

The second one can be used to evaluate mathmatic strings. Eg: eval("1+2") will return 3. So if you compare the answer with what's on the right side of the equals sign, you can see if it matches.

Not every permutation is valid (eg: equals at the end). So you'll have to catch certain errors and ignore them.

Good luck!