What symbol do you use to declare tuples?
()
How do you declare a list?
How can you run through each element of a data structure?
How do you change a string to a list?
list()
How do you define a dictionary?
{}
What is one instance where you can change the elements of a tuple?
When a mutable data type is in it.
What is one instance where you cannot change the elements of a list?
When an immutable data type is in it.
How do you terminate a for loop?
break
How do you use join()?
character_you_split_by.join(list_you_are_converting)
A dictionary value is assigned to a ____.
key
What is one thing you cannot do to a tuple?
Change its elements.
What does the term homogenous mean in relation to lists?
How do you go to the beginnig of a for loop?
continue
How do you make a string uppercase?
string.upper()
Once you have created a dictionary, how do you change one of its elements? (Use vocabulary words and write the format on the board)
dictionary_name[key] = value
How can you change a tuple's elements?
Rewrite it with different elements.
How specifically can you change an element of a list?
my_list[index] = element
How would you count the elements in a data structure with a for loop?
count = 0
for character in data_structure:
count += 1
print(count)
How do you make a string lowercase?
string.lower()
What is the main difference between a dictionary and a list?
A list only stores elements, while a dictionary stores elements which can have their own separate value.
Create an empty tuple with the number 5.
(5,)
What does heterogenous mean in relation to lists?
How do you use two variables as your increment in a for loop?
enumerate()
How do you use a program to see if a letter is uppercase without using .isupper()?
if letter != letter.lower():
print("It is uppercase.")
Create a dictionary with the names Charlie Brown, John Adams, and Mark Green and assign only a blank as their elements. Create a program to assign the number of LETTERS in the name to each key and print the final dictionary. You have 4 minutes. Write the code on the board.
names = {
"Charlie Brown": "",
"John Adams": "",
"Mark Green": ""
}
for name in names:
letters = 0
for letter in name:
if letter.isalpha() == True:
letters += 1
names[name] = letters
print(names)