Elements in a list should be surrounded by ________.
Square brackets
Dictionary elements have a key and a _____.
Value
This kind of loop should be used when you want to run a section of code “n times”.
For loop
True or false? A function always returns an output.
False
x = 32
y = 5
print(x%y)
2
The number of elements in a list is its ____.
Length
True or false? Dictionaries can be used for video games, recipes, schedules, and more.
True
True or false? I can use an elif statement before I use an if statement.
False.
If a function does not need parameters, you still must put ______ after the function name.
Parentheses.
for i in range(3):
print(“This is loop number “ + str(i))
This is loop number 0
This is loop number 1
This is loop number 2
True or false? List names can start with a number.
False
True or false? Dictionary elements can have the same key.
False.
A ____ loop is when a loop runs forever and has no end. (we want to avoid this from happening!)
Infinite
This is what you put between the parentheses after a function name.
Parameters.
day = “Tuesday”
time = “morning”
if ( day == “Tuesday”):
if (time ==”morning”):
print(“Go to school”)
elif (time == “night”):
print(“Go to bed”)
elif (day == “Saturday”):
print(“yay, no school today!)
Go to school
The first item in a list has the index ___.
0
The type of brackets used to create a dictionary are _____.
Curly brackets
if (5%2 == 0):
print("This is a modulo function")
Nothing! 5%2 is one, not zero
To create a function, use this three letter keyword.
"def"
listName = [1, 2, 3, 4, 5, 6]
print(listName[1])
2
To add an item to the end of a list, use <List_name>.______(value)
append
Dictionaries are different from lists because dictionaries don't have ______.
An index
While loops repeat as long as a certain _______ _______ is met.
Boolean condition
The part of a function where actions/commands are carried out is called _____.
The body.
ages = {“Emma”: 21, “Emily”: 20, “Molly”: 19, “Sophie”: 13}
print(ages[“Emily”])
20