W01 Teach - Problem 2 Approach
To solve the List Selector problem, we will need to do the following as we loop through the selector list:
If the current value in the selector list is a 1, then we want to get the next item from the first list
If the current value in the selector list is a 2, then we want to get the next item from the second list
We need to append the value we just selected to the new list
We will need a way to determine what the next item is in either list 1 or list 2. We will need variables to keep track of where we are (i.e. the index) in both lists:
pos_list1- We will use this to keep track of the index of the next item in the first listpos_list2- We will use this to keep track of the index of the next item in the second list
We will initialize both of these variables to 0. When we select an item from one of the lists (per the selector list) we will add one to either pos_list1 or pos_list2 depending on which one was selected.