[Please help] Guided Project: Profitable App Profiles for the App Store and Google Play Markets

Hello everyone,

I’m working on the first Guided project: Profitable App Profiles for the App Store and Google Play Markets, reading the solution but still fail to understand 2 things:

  1. rows_and_columns=False - Why do we need it here and if we don’t use it, what can happen?
  2. explore_data(android, 0, 3, True): To my understanding, we already set android = android[1:] in the previous code line. Therefore, it’s supposed to print 4 lines of data: 0,1,2,3, why does it only print 3?

I’m a newbie trying to figure out the logic of the machine and abit struggling. :smiley:

Thanks in advance for your help!!

Hi VanGiang,

first of all: i think topics regarding guided projects should be posted in the category ‘share’ → ‘guided project’.


  1. the parameter rows_and_columns is False by default, meaning if you do not supply an input for this parameter when calling the function it will be False.
    The last part of the defined function ‘explore_data’ checks whether rows_and_columns is True.
    If this is the case then it will print the number of rows and columns.
    If it is False nothing will be printed.
    Since the default is False this part of the function will only be executed when you supply True as an input for parameter rows_and_columns when calling the function.

  2. When slicing a list like a_list[a:b] the list will contain a until b, so b itself will not be included.
    So android[0:3] will show row 0, 1 and 2.

Kind regards,

Hi leonhekkert,

Thanks for your response. I definitely will pay attention to the folder next time :smiley:

Your responses are very clear to me about why the function work!

However, I still don’t understand why we need rows_and_columns parameter in this case to begin with. What i mean is: what’d be the issue if we just write

print(‘Number of row:’, len(dataset))

because then, I guess the computer’s still gonna calculate the length of the dataset and return the result. There should be some fundamental that I lack to understand this.

Can you please help me to explain this as well. Thanks alot!!!

Best Regards,

Hi @VanGiang and welcome to the community!

The Share category is for when you want to share a completed project. If you want to ask a question about a Guided Project then it should be post it in Q&A as @VanGiang as done here.

The reason for using the variable rows_and_columns in our function is so that IF we wanted information about the rows and columns of our dataset, we can get it by setting this variable to TRUE and get a bit more information returned to us. This is referred to as a flag in programming.

And you are correct, there would be nothing wrong with using just print('Number of rows: ', len(dataset))…that is perfectly valid code and will return the number of rows in our dataset. However, it won’t return any information about our columns and maybe we would want that information as well?

1 Like

Thanks @mathmike314 for the answer!

I’ve tried to research about flag in programming for more understanding.

So to sum up, the rows_and_columns that’s been used in the function in this case is not specifically used for counting the rows and columns, but actually have been “bookmarked” for future use in case of any other needs. Am I correct?

I’ve tried the code without the rows_and_columns and it does work still, as you said!

Thanks & Regards,

The term flag is used in many areas of programming and I got my first exposure to it decades ago while learning DOS. You can find an article here with some examples that show the concept.

Essentially, in our case, a flag is a way to signal to our program that you want it to perform a task with a certain option applied. Specifically, rows_and_columns is our flag and it can be set to TRUE or FALSE. When it’s set to TRUE, the function will return additional information about the rows and columns to us and when it’s set to FALSE the function will not execute that “extra bit” of code.

Almost but not quite… You are correct that the variable rows_and_columns does not specifically count the rows and columns itself but rather indicates or flags the program to execute some additional code. In our case, the additional code to be run is the code that returns information about the rows and columns of our dataset. In other words, we can run our program so that it returns information about the rows and columns or we could run it so that it doesn’t return information about our rows and columns. The choice is ours!

If we do not want info on the rows and columns we would execute: explore_data(android, 0, 3, False)
If we do want info on the rows and columns we would execute: explore_data(android, 0, 3, True)

Awesome! But what if you didn’t want that information on rows and columns returned? What if you only wanted the function to print the rows between start and end? Without the use of a flag variable, there is no way to turn this option “on/off.” Using the rows_and_columns variable as a flag allows us to decide if we want that additional information returned or not.