Chapter 2: Intro to Python Flashcards
What are the 4 array types?
Dictionary, List, Tuples, Sets
What is a Dictionary Array type?
dict,
unordered, changeable, indexes, no duplicates. Can access items by [“key”]
{“course”: “Data Science”, “mode”: “Online”}
What is a List?
list
ordered, changeable, duplicates are OK.
Can access items by [index#]
[“Adam”, “Betsy”,”Cherry”, “Betsy”]
What is a Tuples?
tuple
ordered, unchangeable, duplicates are OK
Can access items by [index#]
(“may”, “june”,”july”)
What is a Sets?
set
unordered, unindexed, no duplicates
Cannot access items by [index#]
(“may”, “june”,”july”)
Which array types are unordered?
Dictionary, and Sets
Which array types are ordered?
Lists, Tuples
Which array types are unchangeable?
Tuples
Which array types are changeable?
Dictionary, Lists
What are membership operators?
To test if a value belongs to a list of data, a string of data, or a tuple of data
What are the 3 python logical operators?
And, Or, Not
When is AND true?
When both comparative statements are true.
When is OR true?
When at least 1 of 2 comparative statements is true.
What is a pass statement?
it is a statement that allows action-less if statement run.
What type of control flow are for and while loop?
Iteration
A for loop iterates over a
sequence
In a for loop, if the range is set to (1:3), how many iterations will the for loop run for?
2
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
The number of genres in the list.