Help with Guided Project: Profitable App Profiles for the App Store and Google Play Markets. Arguments for explore_data() start and end

Guided Project: Profitable App Profiles for the App Store and Google Play Markets

The function explore_data has 4 arguments. I am confused as to what to parse to the start and end arguments? When I looked at the solution, they passed 0 and 3. I however don’t understand how the 0 and 3 came about.
The question defined the start and end as:

  • start and end, which are both expected to be integers and represent the starting and the ending indices of a slice from the data set.
    It was used this way: explore_data(ios,0,3,True)

See the code below:
def explore_data(dataset, start, end, rows_and_columns=False):
dataset_slice = dataset[start:end]
for row in dataset_slice:
print(’\n’) # adds a new (empty) line after each row

if rows_and_columns:
    print('Number of rows:', len(dataset))
    print('Number of columns:', len(dataset[0]))

As the content states, explore_data()

Slices the dataset using dataset[start:end]

That means, it’s being used to access a specific subset of the dataset. When you learned about lists in Python, you covered slicing as well. For example, for the following list -

a = [2, 5, 1, 6, 4]

You can slice the above list as a[1:3] and that will return 5, 1. You are extracting a subset of the list based on the indices you specify (in this example those are 1 and 3).

If the above example is confusing to you, I would recommend going through the list related content again.

You are doing the same in explore_data. start and end are those indices. So, you are using those to extract a subset of the data starting from the start index to the end index.

Those are just randomly selected start and end integer values. As the instructions state -

Explore both datasets using the explore_data() function.

You are supposed to explore the datasets, so you can select whatever indices you want to print a subset of the datasets. In the solution, they chose 0 and 3. You could choose some other integers if you want to and explore the datasets.

Let me know if the above helped.

Thank you very much the_doctor for taking time to answer my question. Your explanation is very clear and clears my confusion. I understand very well the slicing concept. I think I got confused by the output (there were more rows) that was shown in the solution with what was specified as the arguments (0,3).
Most appreciated.