Function to generate a fixed number of even or odd terms . The size of r decides whether numbers to be generated even or odd .
def gen ( n , r ) : NEW_LINE INDENT a = r [ - 1 ] NEW_LINE a += 1 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT r . append ( a ) NEW_LINE a += 2 NEW_LINE DEDENT return r NEW_LINE DEDENT