Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import itertools
  4.  
  5. # Complete this grid with the digits (1, 2, 3, 4, 5, 6)
  6. # to make the sum correct:
  7. #
  8. # [ ] + [ ] - [ ] * [ ] / [ ] * [ ] = 50
  9. #
  10.  
  11. def calculate(a, b, c, d, e, f):
  12.     #return a + b - c * d / e * f
  13.     return (((((a + b) - c) * d) / e) * f)
  14.  
  15. i = itertools.permutations('123456')
  16. for p in i:
  17.     t = tuple(int(x) for x in p)
  18.     print t
  19.     print calculate(*t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement