This one required just a little logic to start out with. It’s a simple combinations/permutations problem. There’s 40 permutations of moves needed, but 20 right moves and 20 down moves are the same, and thus must be removed.
I’ve also started adding in some simple header and footer work to the scripts. These include some breakpoint lines and start and stop times. These are helping me visually see what is going on and also help manage the efficiency of my scripts.
from time import time
start_time= time()
print """Process started
----------"""
from math import factorial
total= factorial(40)/(factorial(20)*factorial(20))
print total
end_time= time()
elapse_time= end_time - start_time
print '----------'
print elapse_time, 'seconds have passed'