42. List Slicing Flashcards

1
Q

How do you do list slicing?

A

it is when you choose how much you want from a list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you do list slicing when you have
amazon_cart = [
‘notebook’
‘sunglasses’,
‘food’

A

print(amazon_cart[0::2]

[‘notebook’, ‘toys’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you replace something in a list?

A

file_name_e[0] = ‘new name’

file nammee is like the name of the list, and 0 is the place where your old name is in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly