TypeError: list indices must be integers or slices, not str
First, array_length should be an integer and not a string: Second, your for loop should be constructed using range: Third, i will increment automatically, so delete the following line: Note, one could also just zip the two lists given that they have the same length: