0 0 votes Consider the following Python code:def process(*nums): f = lambda x, y: x + 2 * y pairs = zip(nums, nums[1:]) return tuple(f(a, b) for a, b in pairs) print(process(1, 3, 5, 7))What is the output of the code above?(4, 8, 12)(7, 13, 19)[7, 13, 19](5, 9, 13) Programming in Python goclasses goclasses-da-dpp goclasses-da-dpp-day-205 programming-in-python goclasses-python-&-dsa-practice-questions output + – GO Classes 105 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes The parameter $\texttt{*nums}$ collects all arguments into a tuple.nums = (1, 3, 5, 7)The lambda function is:lambda x, y: x + 2 * yNow:zip(nums, nums[1:])This forms pairs from consecutive values.(1, 3), (3, 5), (5, 7)Apply the lambda function on each pair:f(1, 3) = 1 + 2 * 3 = 7 f(3, 5) = 3 + 2 * 5 = 13 f(5, 7) = 5 + 2 * 7 = 19The result is converted into a tuple.(7, 13, 19)Correct Option: B GO Classes answered Jun 20 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.