finish rewrite array questions in Python