a = [2]
a.append(a)
And I print a,
[2, [...]]
Also I print a[1][0]
2
What is [...] ? and when I print a[1][0], print 2, not [...] ?
a = [2]
a.append(a)
And I print a,
[2, [...]]
Also I print a[1][0]
2
What is [...] ? and when I print a[1][0], print 2, not [...] ?
... is the ellipsis object. Here it is issued because else it would print forever! (due to infinite recursion)
and: print(a[1][0]):
a[1] is a so a[1][0] is 2, like a[1][1][1][1][0] is 2 too.
Ellipsis ... is used for slicing multidimensional numpy arrays.
The ellipsis syntax may be used to indicate selecting in full any remaining unspecified dimensions.
a[1] is [2, [...]]
so, a[1][0] is 2.