Here is my code:
test_list= [
["Romeo and Juliet","Shakespeare"],
["Othello","Play"],
["Macbeth","Tragedy"]
]
value = "Tragedy"
print(test_list.index(value))
As a result I get “ValueError: ‘Tragedy’ is not in list
I’d come to the conclusion that .index only works for 1D arrays? But then how do I do it die 2D arrays? This code works fine if I make the array 1D. Please help, but in simple terms as I am a beginner.
Apologies for formatting issues on mobile. The array is set out correctly for me.