वह कौन सा व्यंजक है जो 'baz' में 'z' लौटाता है?
What is the expression that returns the 'z' in 'baz'?
x=[10, [3.141, 20, [30, 'baz', 2.718]]] A
x[1][0][1][2]
B
x[1][0][1][2]
C
x[1][2][0][2]
D
x[1][2][1][2]
Explanation
To access the 'z' in the string 'baz' from the given list:
The string 'baz' is located in the third position of the nested list (inside x[1][2]), and you can access the character 'z' by indexing into the string:
Here's the breakdown:
x[1]accesses the second element of the outer list:[3.141, 20, [30, 'baz', 2.718]].x[1][2]accesses the third element of that list:[30, 'baz', 2.718].x[1][2][1]accesses the second element of that inner list:'baz'.x[1][2][1][2]accesses the third character of the string'baz', which is'z'.
So, the correct expression is:
Correct Answer: C) x[1][2][0][2]