1 1 vote Consider the following Python code:t = ("GATE", 2027, "DA", 3.5) single = ("AI",) print(t[0], t[-2], t[1:3], len(single))What is the output of the code above?GATE 2027 ('DA', 3.5) 2GATE DA (2027, 'DA') 1GATE DA [2027, 'DA'] 1GATE DA (2027, 'DA') 2 Programming in Python goclasses goclasses-da-dpp goclasses-da-dpp-day-205 programming-in-python goclasses-python-&-dsa-practice-questions output + – GO Classes 124 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes The tuple is:t = ("GATE", 2027, "DA", 3.5)The expression $\texttt{t[0]}$ gives the first element.t[0] = "GATE"The expression $\texttt{t[-2]}$ gives the second element from the end.t[-2] = "DA"The slice $\texttt{t[1:3]}$ starts from index $\texttt{1}$ and stops before index $\texttt{3}$.t[1:3] = (2027, 'DA')A single-element tuple needs a comma.single = ("AI",)So $\texttt{len(single)}$ is $\texttt{1}$.Therefore, the output is:GATE DA (2027, 'DA') 1Correct Option: B GO Classes answered Jun 20 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.