2 2 votes Consider the following Python code:letters = ["A", "B", "C"] numbers = [1, 2, 3] pairs = list(zip(letters, numbers)) print(pairs[1], pairs[-1][0] + str(pairs[0][1]))What is the output of the code above?('A', 1) C1('B', 2) C1('B', 2) A3['B', 2] C1 Programming in Python goclasses goclasses-da-dpp goclasses-da-dpp-day-206 programming-in-python goclasses-python-&-dsa-practice-questions output + – GO Classes 96 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes The $\texttt{zip()}$ function pairs elements from the given iterables position-wise.letters = ["A", "B", "C"] numbers = [1, 2, 3]So:pairs = [('A', 1), ('B', 2), ('C', 3)]Now $\texttt{pairs[1]}$ gives the second tuple.pairs[1] = ('B', 2)Also, $\texttt{pairs[-1]}$ gives the last tuple.pairs[-1] = ('C', 3) pairs[-1][0] = 'C'And $\texttt{pairs[0][1]}$ gives $\texttt{1}$.pairs[-1][0] + str(pairs[0][1]) = 'C' + '1' = 'C1'Therefore, the output is:('B', 2) C1Correct Option: B GO Classes answered Jun 22 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.