Discussion 12:
Data Structures in Python
�Grab a worksheet and log onto iClicker!
Question of the Day:
Ask the person to your right / left how they’re doing! Midterm season can be stressful 🫠
Question of the Day!
Question of the Day
Midterm season can be stressful 🫠
Social Implications
AlphaStar AI in StarCraft - Article
Critical Thinking Questions:
Translate from Snap!
to Python
For this discussion, you will be using the starter file: tinyurl.com/sp25-disc12
Translate the Snap! code to its Python equivalent:
Translate the Snap! code to its Python equivalent:
Translate to Python list comprehension equivalent:
Translate to Python list comprehension equivalent:
Hint: Combine using the _ + _ in Snap! can be done using the sum(lst) function in Python
Data Structures
Fill out the table below with the Python syntax:
Function Time!
Write a function called merge_dicts that takes in two dictionaries as inputs and returns a new dictionary as output that contains all entries from both input dictionaries. You can assume that both dictionaries have Strings as keys and Integers as values. For any keys present in both dictionaries, the corresponding value in the output dictionary should be the sum of the values from the inputs. You cannot assume both dictionaries are the same length.
Function Time!
Write a function called remove_vowels that takes in a tuple of strings as an input and returns a new tuple as an output that removes all vowels from each string in the output tuple. Hint: Tuples are immutable, but you can always cast a data type like a list to a tuple.
After executing, what’s the value of names
Q&A + Feedback Form