This lesson requires a premium membership to access.
Premium membership includes unlimited access to all courses, quizzes, downloadable resources, and future content updates.
In the previous lessons, we learned about how to loop over lists. In this lesson, we will learn about how to loop over python dictionaries and Numpy arrays.
To loop over a dictionary elements, we use the items() method provided with a dictionary object. Let's say we have the following dictionary containing the a list of stocks along with their prices.
1portfolio = {"GOOGL":849, "FB":136, "MSFT":64, "AAPL":136, "AMZN":848}
2