Lecture 8: Lists and Mutability
Lecture 8: Lists and Mutability
Check-in and Reminders
? Reminder: Homework 3 out: pick up from the front ? How to approach homework questions:
? You can test out pieces of code in interactive python ? But the best way to learn is to walk through the logic of the code
using pencil and paper (without a machine) ? Homework are the best practice for exams! ? Lab 3 due tonight for Mon labs, tomorrow night for Tues ? Our office hours ? Today: Iris (12-1 pm), Me (12.30 - 2pm @ CS common room) ? Tomorrow: Iris (10 am-noon), Me (1-2 pm)
Do You Have Any Questions?
Fast Paced Course: Practice is Key!
? This is a very fast paced course ? To keep up, you must practice what we learn in lectures ? Learning a new language is all about immersing yourself in it ? Best way to learn French?
? Go live in France for a bit ? Best way learn Python?
? Live in PythonWorld! Play with examples in interactive python ? Test out code we do in class on your own ? Get ahead, stay ahead. Preparing for the lab by reviewing lectures will make you more productive!
Do You Have Any Questions?
Review: Lists
? We have worked with lists as a sequence (ordered collection of items)
? We know how to concatenate two lists with a + ? We know how to append an item to a list ? Lists, unlike strings, are a mutable sequence ? This means we can update them
? Add items to lists ? Delete items from lists ? Sort lists in place, etc ? Today we will discuss lists in more detail and implications of lists being mutable
Updating by Reassignment
? Update by direct assignment to a list index
Example. myList[1] = 7 # reassign to an existing index
myList Before
[1, 2, 3, 4]
myList After
[1, 7, 3, 4]
................
................
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 princeton university
- python programming 1 variables loops and input output
- lab python programming review
- beyond the basic stuff with python
- computer orange template
- lecture 8 lists and mutability
- new syllabus
- comparing sas and python a coder s perspective
- x86 assembly programming mwftr
- introduction to python
Related searches
- chapter 8 photosynthesis and respiration
- lists of strengths and weaknesses examples
- windows 8 1 and microsoft edge
- ordered and unordered lists html
- money and banking lecture notes
- chapter 8 questions and answers
- home organization lists and charts
- c lists and arrays
- july 8 holidays and observances
- 8 weeks and 3 days ultrasound
- 8 scientific and engineering practices
- fox 8 closing and delays