BestPromptFinderBelow is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Generate a function in Python that takes in a dictionary (string → integer) and returns the sum of all values in the dictionary. ### Input: my_dict = { "a": 5, "b": 10, "c": 15 } ### Output: def compute_dict_sum(input_dict): result = 0 for val in input_dict.values(): result += val return result print(compute_dict_sum(my_dict))
Find similar in the app →