CS177 Python Programming - Purdue University
CS177 Python Programming
Recitation 11 ? Data Collections
Table of Contents
? Review the use of lists (arrays) to represent a collection of related data.
? Review the functions and methods available for manipulating Python lists.
? Review the use of other data collections in Python, such as dictionaries and tuples.
Sequences
? When we have multiple elements stored consecutively in memory we call it a List
? When we have multiple characters stored consecutively in memory we call it a String
? Both of these structures are sequence structured (individual items can be selected by indexing i.e. s[i]).
? Ranges, Lists and Strings are 0 indexed
CS17700 Programming With Multimedia Objects
3
Lists
? Lists are defined by []
? Lists can contain strings, numbers, even other lists.
Print a string (A string of characters)
Print a list (A list of characters)
>>>x = "ABCD" >>>y = ["A","B","C","D"] >>>print (x) ABCD >>>print (y) ['A', 'B', 'C', 'D']
CS17700 Programming With Multimedia Objects
4
Lists
? Lists are more "general purpose"
? Allow heterogeneous elements in the same list
>>> myList = ["X", "B", 3, "A", 1] >>> print (myList) ['X', 'B', 3, 'A', 1] >>> myList = [['X', 'B', 3, 'A', 1], `hello', 99]
CS17700 Programming With Multimedia Objects
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- python tutorial stanford computer vision lab
- working with lists and dictionaries ncert
- python tutorial list and negative indexing
- on to python
- python lists
- python programming 2 regular expressions lists
- cse 142 python slides university of texas at austin
- python day 3 lists branching iwks
- a tiny bit more python
- cs177 python programming purdue university
Related searches
- python programming books free pdf
- best python programming book
- python programming language pdf book
- free python programming books
- python programming pdf free download
- python programming tutorials
- python programming for absolute beginners
- python programming on win32 download
- basic python programming examples
- python programming examples pdf
- python programming examples source code
- introduction to python programming pdf