Week 5: Mouse input, dictionaries and images Flashcards

1
Q

What does list.index(x) do?

A

Shows what “X” is in the list which is being indexed

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

What does list.append(x) do in Python?

A

Adds “x” to the end of the list being appended

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

What does list.pop(X) do in Python?

A

Removes “x” from the list being referenced. If no argument is given then it will remove the last item on the list.

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

Can a list in Python be modified while it is iterating?

A

No, if it is modified while iterating then it may lead to unpredictable behaviour

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

What is a Dictionary in Python?

A

Dictionaries are a way of “mapping” in Python. eg. Keys to Values {1:2} - 1 would be the key, and 2 would be the value; keys are commonly numbers or strings; values have more variety

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