Currently, I have:

for s in range(1,10): for e in range(0,10): for n in range(0,10): for d in range(0,10): for m in range(1,10): for o in range(0,10): for r in range(0,10): for y in range(0,10): send = s*1000 + e*100 + n*10 + d more = m*1000 + o*100 + r*10 + e money = m*10000 + o*1000 + n*100 + e*10 + y if send + more == money: if s!=e and s!=n and s!=d and s!=m and s!=o and s!=r and s!=y and e!=n and e!=d and e!=m and e!=o and e!=r and e!=y and n!=d and n!=m and n!=o and n!=r and n!=y and d!=m and d!=o and d!=r and d!=y and m!=o and m!=r and m!=y and o!=r and o!=y and r!=y: print " %1d%1d%1d%1d" & (s, e, n, d) print " +%1d%1d%1d%1d" & (m, o, r, e) print "------" print " %1d%1d%1d%1d%1d" % (m, o, n, e, y)

When I run in, I get an error:

TypeError: "unsupported operand type(s) for &: 'str' and 'tuple'"

I believe it has something to do with the formatting near the end, but they've never worked for me for some reason.

Now to what I've done... I have tried taking the 'if' statement:

if s!=e and s!=n and s!=d and s!=m and s!=o and s!=r and s!=y and e!=n and e!=d and e!=m and e!=o and e!=r and e!=y and n!=d and n!=m and n!=o and n!=r and n!=y and d!=m and d!=o and d!=r and d!=y and m!=o and m!=r and m!=y and o!=r and o!=y and r!=y:

and distributing the first section:

if s!=e and s!=n and s!=d and s!=m and s!=o and s!=r and s!=y

to the

for s in range(1,10):to produce.

for s in range(1,10): if s!=e and s!=n and s!=d and s!=m and s!=o and s!=r and s!=y: for e in range(0,10): if e!=n and e!=d and e!=m and e!=o and e!=r and e!=y: for n in range(0,10): if n!=d and n!=m and n!=o and n!=r and n!=y: for d in range(0,10): if d!=m and d!=o and d!=r and d!=y: for m in range(1,10): if m!=o and m!=r and m!=y: for o in range(0,10): if o!=r and o!=y for r in range(0,10): if r!=y for y in range(0,10): send = s*1000 + e*100 + n*10 + d more = m*1000 + o*100 + r*10 + e money = m*10000 + o*1000 + n*100 + e*10 + y if send + more == money: print " %1d%1d%1d%1d" & (s, e, n, d) print " +%1d%1d%1d%1d" & (m, o, r, e) print "------" print " %1d%1d%1d%1d%1d" % (m, o, n, e, y)and I was just wondering, would that work if I was to expand and have the program check if the corresponding letter is equal or not equal to another while inside that letters loop? What would be the best course of action?