Confusion with indexing

Hi All,
I’m confused with indexing most of the time because I picture the list of the data as column and row.
How are these functions show different outputs even both data are in the same index?

function 1
print(apps_data[7])
*what I have understood it should print all the ratings because this is the index of the rating but it shows the first 6 data in the lists.

function2
for row in apps_data[1:0]:
rating= row[7]
print (rating)

I believe in your function1 you’re telling it to print the entire row for apps_data[7]. In your function2 you’re trying to loop through the values stored in apps_data at row[1] to row[0], which doesn’t make sense. If you try to print out apps_data[1:0], nothing shows up because it interprets that as a range of values.

if you did something like

print(apps_data{2:6})

then it would print out the data for row 2, row 3, row 4, and row5. Simply put, your indices are not correct.

#some test data I made up
apps_data = [[0,10],
            [1,9],
            [2,8],
            [3,7],
            [4,6],
            [5,5],
            [6,4],
            [7,3],
            [8,2],
            [9,1],
            [10,0]]

def function_1():
    print(apps_data[7]) #this outputs [7,3]

def function_2():
    print(apps_data[1:0]) #look at this output, it prints out an empty list
    for row in apps_data[1:0]: #this line is trying to loop through a list that is empty
        rating = row[7]
        print(rating)