How To Solve Pattern Problems In Python