Unit 13 Flashcards

1
Q

13.2 - List Methods

What is a list method?

A

functions specifically used for lists

append, remove, sort, etc.

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

13.3 - Iterating Over a List

What does all(xlist) do?

A

true if every element != 0 or the list is empty

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

13.3 - Iterating Over a List

What does any(xlist) do?

A

true if any element in the list is true

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

13.3 - Iterating Over a List

What does max(xlist) do?

A

gets highest element in list

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

13.3 - Iterating Over a List

What does min(xlist) do?

A

gets the minimum element in the list

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

13.3 - Iterating Over a List

What does sum(xlist) do?

A

gets the sum of all elements in the list

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

13.5 - List Nesting

How do you get a singular value in a nested list?

A

xlist[0][0]

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

13.8 - Sorting Lists

What is the difference between .sort(), .sorted, and .reverse()?

A

.sort - sorts list in place
.sorted - new list as seperate entity
.reverse - reverses list

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

13.10 - List Comprehensions

What is a list comprehension?

A

uses a for loop to assign a variable
xlist = expression for name in iterable

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