4. Sorting the List would be Better¶
4.1. Sorting is Easier in Memory¶
Disk data is persistent: if you pull the power cord, the computer won’t forget the information saved on the disk.
Data in memory is much faster, but not persistent: data in memory disappears when you exit your program or when the computer is turned off.
Design trade-off: persistence x speed.
4.2. First: Read Data into Memory¶
4.3. Wow, Let’s Use a Data Train¶
Array, list, vector are common names for a complete set of data.
I only need a single variable for the entire data train.
4.4. Back to Surfing …¶
We can create a list
scores.To insert each new score, use
.append().The top positions will be
scores[0],scores[1], andscores[2].
You have attempted of activities on this page
