"if a b c are digits, solve ab:c=a*c+b"

solved in one minute with no thought:

for a in range(10):
    for b in range(10):
        for c in range(10):
            try:
                if (10.*a+b)/c==a*c+b:
                    print "%i%i:%i=%i*%i+%i" % (a,b,c,a,c,b)
            except:
                pass

any suggestion for improvement?

bye
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to