What will be the output of data[-2] from the list data = [1,5,8,6,9,3,4]?
In the list, an element present at the 2nd index from the right is 3. So, the output will be 3. In Python, negative indices in lists are used to access elements from the end of the list. So, data[-2] will access the second-to-last element in the list data, which is 3. Therefore, the correct … Read more