Question 3. Define a function that satisfies the following specifications. Function generate_ans_from_list Parameters 1.
Posted: Fri May 20, 2022 11:50 am
Question 3. Define a function that satisfies the following specifications. Function generate_ans_from_list Parameters 1. A list. Each element of this list is a list of integers. 1. A list of dictionary objects Return Value Detail Information This function should convert the list parameter into a list of dictionaries. Each dictionary will have two string-typed keys – "ans" and "ans". The value for the "ans" key will be a str of the integers taken from each list element in the list parameter. In the str, the integers are separated with the characters " + ". The value for the "ans" key will be the sum of all the numbers in the list. You should skip the lists that contain fewer than 2 integers. There is no need to print anything out. Example: input_list = [[1,3,3), (2, 5, -1], [3,2], [4,5,3], [0,23], [1,2,3,4]] generate_qns_from_list(input_list) I The function should return the following list [{"ans": "1 + 3 + 3", "ans": 7}, {"ans": "2 + 5 + -1", "ans": 6}, {"ans": "3 + 2", "ans": 5}, {"ans": "4 + 5 + 3", "ans": 12}, {"ans": "O + 23", "ans": 23}, {"ans": "1 + 2 + 3 + 4", "ans": 10}] :