Online Python Help and Tutoring
Live Help, Not Pre-recorded Videos
Thursday, June 18, 2015
The Python Report #1
The Python Report has moved to its permanent home at thepythonreport.blogspot.com
Tuesday, March 3, 2015
Data Structures -- Lists
The Big Idea
Every programming language is based on a few Big Ideas that shape the design of the language. A language will often have special syntax to directly support these big ideas.
For example
- pointers (C)
- classes (Java)
- relationships between entities (SQL)
Lists -- A Big Idea
Lists are one of the Big Ideas in Python. And as you would expect, there is a variety of special syntax for working with lists
- the built-in list operator [ ]
- list slices
- negative subscripts
- list comprehensions
- the for statement, which iterates over a list
In addition, many of the built-in functions take a list as a parameter or return a list as a result.
Learning To Work With Lists
Since lists are such an important part of Python, you should spend extra time learning how to work with them. A program that manipulates lists instead of individual variables is often shorter and easier to understand.
At a minimum, you should
At a minimum, you should
- get comfortable working with list slices and negative indexes
- learn to use list comprehensions instead of for loops
- study the built-in list methods
- learn the built-in list functions
- len and enumerate
- sorted and reversed
- min, max, and sum
- zip
Subscribe to:
Posts (Atom)