Class 4: Lists

April 6, 2020

Downloads

Session log

Luis Perez
2020-04-06 09:00:15
**Class started**
Luis Perez
2020-04-06 09:05:46
**Entering breakout rooms**
Luis Perez
2020-04-06 09:05:54
Help! We need a TA! (Reply to this message with the name of your breakout room if you need help)
Luis Perez
2020-04-06 09:14:38
Share one new thing you learned from the 05_listsnotebook? (Reply in thread.)

Cori Cahoon
2020-04-06 09:17:00
how to replace a value in a list in one line without using .insert or .remove
👍1

Natanya Villegas
2020-04-06 09:17:23
I learned that when using some_list I can replace one object with another.

Andrew Holston
2020-04-06 09:18:00
What the colon does when it is inside the brackets

Patrick Connor
2020-04-06 09:18:03
how to copy a list

Amy Robbins
2020-04-06 09:18:09
.insert .pop .remove to modify index positions

Hannah Markovic
2020-04-06 09:18:59
Copying a list just assigns another name to the same values so you need to use the “deepcopy” function

Juan Tirado-Garcia
2020-04-06 09:19:14
Learned how to insert a number on some_list

Daria Wonderlick
2020-04-06 09:19:32
.insert to specify index for inserted object

Abbey Lasseigne
2020-04-06 09:19:46
.remove only removes the first instance of the value you specifiy

Vickie
2020-04-06 09:19:52
how to identify elements in a list

Acadia DiNardo
2020-04-06 09:20:24
how replace different elements in a list

Heather Foote
2020-04-06 09:20:31
I learned that .pop removes a position while .remove, removes a specific integer.

Dillon Willis
2020-04-06 09:20:31
the difference between copy and deepcopy

Jon Muyskens
2020-04-06 09:20:56
Remove only removes the first instance, not all of the instances

Philip Nosler
2020-04-06 09:22:14
That some_list.remove only removes the first instance of the value in the parentheses

Laura Desban
2020-04-06 09:22:50
I learned that you need to use copy.deepcopy to create two independent lists / variables

Ben Camel
2020-04-06 09:23:13
Pop is a command to remove something from a list by its index

Sophia Phillips
2020-04-06 09:23:42
I learned that you can call either positions of elements or the numbers themselves in a list!
Luis Perez
2020-04-06 09:15:42
What should we discuss in the main session from the 05_listsnotebook? (Reply in thread).

Cori Cahoon
2020-04-06 09:17:47
the duplicating a list vs deepcopy a list - not quite sure why we need to make this distinction
💯2

Natanya Villegas
2020-04-06 09:18:34
How are lists used?

Andrew Holston
2020-04-06 09:21:32
Why the extension .pop is used; what does .pop stand for?
👍3
Alice Barkan
2020-04-06 09:16:10
pop vs remove
Tory Herman
2020-04-06 09:16:10
👍1 💯1
Polly Poll
2020-04-06 09:16:21
Poll by @Luis Perez
I would rate my understanding of the material in the 05_listsnotebook as:
😱⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ 0
🙁⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ 0
😐⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ 0
🙂████████ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢8
😄████████████████ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢16
Luis Perez
2020-04-06 09:22:15
**Leaving breakout rooms**
Amy Robbins
2020-04-06 09:38:40
When I tried Mike's code to replace 5 with 423, I got an error: some_list = list(range(10)) some_list[5] = 423 print(some_list)
👍1

Amy Robbins
2020-04-06 09:39:10
Said 'list' object was not callable

Luis Perez
2020-04-06 09:41:36
Try restarting the kernel, I just copied the code into my jupyter notebook and it ran fine
👌1

Amy Robbins
2020-04-06 09:43:19
Yup now it works... stupid kernel... thanks!

Luis Perez
2020-04-06 09:45:14
You're welcome! And just a quick note, lets post all questions in the #help thread

Amy Robbins
2020-04-06 09:47:52
Gotcha my bad I'll figure out all the channels eventually :P

Lila Kaye
2020-04-06 09:49:22
I had the same issue, thanks for asking @Amy Robbins
Polly Poll
2020-04-06 09:50:04
Poll by @Luis Perez
If I wanted to set the 11th entry in a list named some_listto `5`, I should type:
*1*:some_list.set(10) = 50
*2*:some_list[11] = 50
*3*:some_list[10] = 50
*4*:some_list(10) = 50
Luis Perez
2020-04-06 09:51:42
some_list = [-1,0,1,2,3]
print(some_list[1:-1])
Polly Poll
2020-04-06 09:51:59
Poll by @Luis Perez
What would the code block above print?
[0,1,2]█████████ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢9
[-1,0,1,2]⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ 0
[0,1,2,3]██████████████ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢14
[0,1,2,3]█ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢ ⁢1

Laura Desban
2020-04-06 09:52:43
I don't see the difference between 3 and 4

Luis Perez
2020-04-06 09:54:13
poll error

Lila Kaye
2020-04-06 09:54:54
Darn n-1 convention
😅3

Laura Desban
2020-04-06 09:55:32
I'm with you on that one. Matlab didn't format my brain for this
Luis Perez
2020-04-06 09:56:54
**Class ending**