Lists Flashcards
1
Q
Suppose listvar to store a list. How to sort the list in descending order?
A
listvar.sort(reverse=True)
2
Q
how to search for the position of one element e in the list listvar
A
listvar.index(e)
3
Q
How to create a list with the values of a dictionary as entries?
A
mylist = list(mydic.values())
4
Q
check if list not empty
A
an empty list evaluates to False
5
Q
add elemento to list
A
list.append(element)
6
Q
A