I declared a list inside a tuple like this,
a = ([x,y])
Now for accessing the first element x
of the inner list I assumed we would have to use, a[1][1]
.
But it gives an error of out of bounds and we can access the element simply like a[1]
Does this mean singleton tuple can also be declared like a([temp])
along with the usual a(temp,)
? Or is it treated simply as a list?
How does python implement this? I could not find any concrete explanation or documentation.