Written Response 2(c): Data and Procedural Abstraction

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/4

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

5 Terms

1
New cards

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.

2
New cards

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.

3
New cards

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.

4
New cards

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.

5
New cards

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.