To apply the sum() function to all values in a dictionary d… To apply the sum() function to all values in a dictionary d (assuming they are numeric), which is the correct first step shown in the notes? Read Details
What is the result of [x == 5 for x in [3, 5, 7, 5]]? What is the result of [x == 5 for x in [3, 5, 7, 5]]? Read Details
What does each element within the view returned by my_dict.i… What does each element within the view returned by my_dict.items() typically consist of? Read Details
If users = {“u1”: “Alice”, “u2”: “Bob”}, what is returned by… If users = {“u1”: “Alice”, “u2”: “Bob”}, what is returned by users.pop(“u1”)? Read Details
What happens if you try to run sum(list(user_roles.values())… What happens if you try to run sum(list(user_roles.values())) where user_roles = {“alice”: “admin”, “bob”: “editor”}? Read Details
If sales_data = [{“day”: “Mon”, “amount”: 100}, {“day”: “Tue… If sales_data = [{“day”: “Mon”, “amount”: 100}, {“day”: “Tue”, “amount”: 150}]. How would you sum the “amount” values using concepts covered? (Without loops). Read Details
Which expression correctly checks if the key “port” exists i… Which expression correctly checks if the key “port” exists in the dictionary settings? Read Details
Start with d = {}. Then execute d[‘a’] = 1, d[‘b’] = 2, d[‘c… Start with d = {}. Then execute d[‘a’] = 1, d[‘b’] = 2, d[‘c’] = 3, d.pop(‘b’). What is len(d)? Read Details
Given keys = [‘a’, ‘b’, ‘c’] and values = [1, 2, 3], what do… Given keys = [‘a’, ‘b’, ‘c’] and values = [1, 2, 3], what does {k: v for k, v in zip(keys, values)} produce? Read Details
If data = {“item”: “Book”, “qty”: 5} and you execute data[“i… If data = {“item”: “Book”, “qty”: 5} and you execute data[“item”] = “Magazine”, what best describes what happened? Read Details