Chapter 2: Intro to Python Flashcards

1
Q

What are the 4 array types?

A

Dictionary, List, Tuples, Sets

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

What is a Dictionary Array type?

A

dict,
unordered, changeable, indexes, no duplicates. Can access items by [“key”]
{“course”: “Data Science”, “mode”: “Online”}

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

What is a List?

A

list
ordered, changeable, duplicates are OK.
Can access items by [index#]
[“Adam”, “Betsy”,”Cherry”, “Betsy”]

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

What is a Tuples?

A

tuple
ordered, unchangeable, duplicates are OK
Can access items by [index#]
(“may”, “june”,”july”)

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

What is a Sets?

A

set
unordered, unindexed, no duplicates
Cannot access items by [index#]
(“may”, “june”,”july”)

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

Which array types are unordered?

A

Dictionary, and Sets

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

Which array types are ordered?

A

Lists, Tuples

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

Which array types are unchangeable?

A

Tuples

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

Which array types are changeable?

A

Dictionary, Lists

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

What are membership operators?

A

To test if a value belongs to a list of data, a string of data, or a tuple of data

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

What are the 3 python logical operators?

A

And, Or, Not

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

When is AND true?

A

When both comparative statements are true.

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

When is OR true?

A

When at least 1 of 2 comparative statements is true.

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

What is a pass statement?

A

it is a statement that allows action-less if statement run.

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

What type of control flow are for and while loop?

A

Iteration

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

A for loop iterates over a

17
Q

In a for loop, if the range is set to (1:3), how many iterations will the for loop run for?

18
Q

What is this for loop looking for?

genre = [“Action”,”Adevnture”,”Animation”,”Biography”,”Comedy”,”Crime”,”Drama”,”Family”,
“Fantasy”,”History”,”Horror”]

count = 0
for value in genre:
count = count + 1

A

The number of genres in the list.