Lists Flashcards

1
Q

Suppose listvar to store a list. How to sort the list in descending order?

A

listvar.sort(reverse=True)

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

how to search for the position of one element e in the list listvar

A

listvar.index(e)

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

How to create a list with the values of a dictionary as entries?

A

mylist = list(mydic.values())

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

check if list not empty

A

an empty list evaluates to False

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

add elemento to list

A

list.append(element)

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