Driver code
if __name__ == " _ _ main _ _ " : NEW_LINE INDENT input_mat = [ [ 1 , 0 , 1 , 1 ] , [ 0 , 1 , 1 , 1 ] , [ 1 , 1 , 1 , 1 ] , [ 0 , 1 , 1 , 0 ] ] NEW_LINE n = 4 NEW_LINE print ( countEndless ( input_mat , n ) ) NEW_LINE DEDENT