1/4
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
AAP-1.D.a: Develop data abstraction using lists to store multiple elements
I use a list inside each sector dictionary to store multiple stocks, and each stock is a dictionary of attributes. The portfolio is also a list storing purchased stocks.
AAP-1.D.b: Explain how data abstraction manages complexity
By storing stocks in a list, I can display them using one loop regardless of how many there are. This avoids needing separate variables for every stock, keeping the code short and flexible.
AAP-2.O.a: Write iteration statements to traverse a list
In display_stocks(), the for i, stock in enumerate loop traverses the list of stocks to display each one’s name, symbol, price, and other attributes.
AAP-2.O.b: Determine the result of an algorithm with list traversals
In that loop, each stock is printed in a formatted row. The result is a full table of all stocks in the
selected sector.
AAP-3.B: Explain how procedural abstraction manages complexity
I created the buy_stock() and display_stocks() functions to separate tasks like purchasing and displaying. This makes the main loop cleaner and allows each function to be reused when needed.