If N is odd , half + 1 position can be filled to cope with the extra middle element
if ( N & 1 ) : NEW_LINE INDENT half += 1 ; NEW_LINE DEDENT ans = 1 ; NEW_LINE for i in range ( 1 , half + 1 ) : NEW_LINE INDENT ans *= K ; NEW_LINE DEDENT