Lists Flashcards

1
Q

A list

A

used to store multiple items in a single variable

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

2d lists

A

A list of lists

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

List example
Name of list: Food
Items in list: pie,cream and waffles

A

Food = [“pie”, “cream”, “waffles”]

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

Finding the first index of “Food”

Food = [“pie”, “cream”, “waffles”]

A

Food[0]

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

2D list example

The 2D list “Food” made up of variables such as breakfast,lunch,dinner

A

Food = [breakfast,Lunch,Dinner]

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

Finding the second index of the second list in a 2D list:

A

List_name[1][1]

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

Tuple

A

Collection which is ordered and h changeable
-used to group together related data

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

Is a bracket or square bracket used in a tuple?

A

() bracket

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

Example of tuple:
This tuple is called creator
And contains Alex,15 and male

A

Creator = (“Alex”,15,”male”)

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

sets

A

A collection which is unordered,unindexed and has no duplicate values
(Uses {} curly brackets)

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

Set example:
Set is called children and contains Billy,Timothy and Johnathan

A

Children = {“Billy”,”Timothy”,”Johnathan”}

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

Dictionary

A

A changeable, unordered collection of unique key: value pairs

-a fast because they use hashing meaning values can be accessed quickly

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

Dictionary example:
Name of dictionary is Animals
Contains the keys:Reptiles,birds,amphibians

A

Animals = {‘reptiles’: ‘lizard’, ‘birds’: ‘parrots’ , ‘amphibians’: ‘frog’}

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

“Items” in a dictionary

A

Refers to the key and value in dictionaries

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

What does .items() do in a dictionary?

A

It gives access to the keys values