7. Display Cart
Screen 3 has our grand total for all of the items in the cart displayed. When the user clicks the checkout button, we are going to take them to screen three and show them their total cost. In order to make this happen, we first have to loop through our entire cart and add up each item. Once we find the sum of the list, we are going to set the text of the label that shows our total, and then set the screen to screen 3; and bingo, we have a working app.
The value of i in a for loop tracks the same way an index value does in a list. Meaning for every time a loop iterates, i follows the same value that each new item in a list would. If we can then use that value of i to move through list and update sum, then we have the grand total.