Class Notes (839,394)
Canada (511,324)
CS 234 (31)
Lecture

notes05a.pdf

2 Pages
136 Views

Department
Computer Science
Course Code
CS 234
Professor
Robert Sproule

This preview shows 80% of the first page. Sign up to view the full 2 pages of the document.
Description
bc2chow   CS 234: Lecture 5                                  May  21,  2013   List  in  Python     • 1-­‐d  array     • Contiguous  block  of  memory     • Size  fixed  when  created     • Subarray  –  items  are  stored  in  a  contiguous  subset  of  the  array         List  Operators     • Creating  lists       L=[4,  5,  1,  1,  -­‐3]   • Access  elements  in  lists     L[0]    4   L[3]    1   • Slicing  [:]   L[:2]    [4,  5]   L[3:]    [1,  -­‐3]   L[:]    [4,  5,  7,  1,  -­‐3]     Examples:     L    [4,  5,  7,  “c”,  -­‐3]     Input   Results     Note     L1=L   L    [4,  5,  7,  “c”,  -­‐3]    L1       L1=L[:]   L    [4,  5,  7,  “c”,  -­‐3]       L1    [4,  5,  7,  “c”,  -­‐3]     L3=L[:2]   L3    [4,  5]     L[3]       “c”       L1[3]     “c”     len(L)       5     L.append(47)       [4,  5,  7,  “c”,  -­‐3,  47]     L.append([-­‐5,  3])       4,  5,  7,  “c”,  -­‐3,  47,  -­‐5,  3]     L.extend(L1)    
More Less
Unlock Document

Only 80% of the first page are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit