1 / 4

Lists in Python

Lists in Python. Parallel lists. Parallel lists. This is a technique for using lists which goes back to the early days of programming It’s not new syntax, just a slightly different way to look at arrays

edwardr
Download Presentation

Lists in Python

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lists in Python Parallel lists

  2. Parallel lists • This is a technique for using lists which goes back to the early days of programming • It’s not new syntax, just a slightly different way to look at arrays • Many languages have a restriction that an array can be only one type, an integer array, a string array, etc.

  3. Sometimes the situation required storing both floats and strings, for example (GPAs and names). • One piece of data, a GPA, belongs with another piece of data, a name. • Since they could not be put in the same array, they were put in separate arrays, but in the same position.

  4. Parallel arrays • By using the same subscript for both arrays, you are referring to related data. • The main thing to remember is if you move data around in one of the arrays, you must make the same moves in the other array • Nothing in the language enforces this relationship, it’s up to your programming

More Related