11# 1.5 Lists
22
3- ## Notes
3+ This section introduces lists, one of Python's basic objects for storing collections of data.
44
5- ### String Splitting
5+ ## Reading
66
7- Strings can represent fields of data. We can work with each field by splitting the string into a list.
7+ ### Creating a List
8+
9+ Use square brackets to create a list:
10+
11+ ``` python
12+ names = [ ' Elwood' , ' Jake' , ' Curtis' ]
13+ nums = [ 39 , 38 , 42 , 65 , 111 ]
14+ ```
15+
16+ Sometimes lists are created by other methods. For example, a string can be split into a
17+ list using the ` split() ` method:
818
919``` pycon
1020>>> line = ' GOOG,100,490.10'
@@ -14,18 +24,9 @@ Strings can represent fields of data. We can work with each field by splitting t
1424>>>
1525```
1626
17- A common use case for this splitting is when reading data from a file. You might read each line as text and then split the text into columns.
18-
1927### List operations
2028
21- Use square brackets to create a list:
22-
23- ``` python
24- names = [ ' Elwood' , ' Jake' , ' Curtis' ]
25- nums = [ 39 , 38 , 42 , 65 , 111 ]
26- ```
27-
28- It can hold items of any type. Add a new item using ` append() ` :
29+ Lists can hold items of any type. Add a new item using ` append() ` :
2930
3031``` python
3132names.append(' Murphy' ) # Adds at end
@@ -84,7 +85,7 @@ s = [1, 2, 3]
8485s * 3 # [1, 2, 3, 1, 2, 3, 1, 2, 3]
8586```
8687
87- ### List Iteration & Search
88+ ### List Iteration and Search
8889
8990Iterating over the list contents.
9091
0 commit comments