What does "app" stand for in this excerise?


Please see below the code I have a question about

for app in apps_data[1:]:
price = float(app[4])
if price == 0.0:

in the first line of this code, there is the use of the word ‘app’. Where did this word come from and what does this word mean in the code. I tried replacing this with randon three alphabets ‘xyz’ and the code does not execute. So obviously the use of the word ‘app’ means something here. Just trying to understand what this is.

Yep, I am rank new beginner to coding.

Thanks for your help

It is just a name to represent each sample of your dataset generically during the loop. You can replace it for whatever word you want to, as long as you do it in the entire code.

With that said, something is wrong in your code. You should not append anything to app. It is not a list. You need to create an empty list before the loop for that.

Hi Otavios,

Thank you for your response.

Your last statement there that I need to create an empty list before the loop makes complete sense to me and that is why I am so confused with two of the lessons here. The code in this question, is something that I copy pasted from the exercise itself.

Path to the exercise is as follows
Course - Data Engineering > Step1> Course 1/3> Conditional Formatting > 10/13 and 11/13.

Here is the URL for these two exercises.

If by any chance you could please take a look and let me know what I might be not understanding correctly, I would greatly appreciate it.

It is not terribly easy to get my questions answered just by googling them. And it so helps to have someone help me. Thank you again so much.


Oh OK!

In this case you actually should append to app. I’ll explain.

Your apps_data variable is a list full of other lists. A list of lists. It is your dataset.

Try to see this list of lists as a table where each list inside is a row of the table.

The first row (the first list inside the list of lists) is the header. That’s why when you use the for you use apps_data[1:], because apps_data[0] is the header, not the data.

In this particular case, what you are trying to do is to add another column to your whole dataset. Therefore you need to append one extra value in each row (each list). But what value?

In this case you are trying to specify if the app is free or not. That’s why for app in apps_data[1:]: you you check if the price of the app is 0. If so, you’ll then append the label free to its column. If not you’ll append non-free.

This is the original row of your data set (as said, a list):

'284882215', 'Facebook', '389879808', 'USD', '0.0', '2974676', '212', '3.5', '3.5', '95.0', '4+', 'Social Networking', '37', '1', '29', '1']

As you can see, the price is zero. So you’ll append the label free to it, and then your row will be:

'284882215', 'Facebook', '389879808', 'USD', '0.0', '2974676', '212', '3.5', '3.5', '95.0', '4+', 'Social Networking', '37', '1', '29', '1', 'free']

Does it make sense now?

Notice that after the loop, you add the name of the new column you just created to the header:


Try to see it as a table:

['id', 'track_name', 'size_bytes', 'currency', 'price', 'rating_count_tot', 'rating_count_ver', 'user_rating', 'user_rating_ver', 'ver', 'cont_rating', 'prime_genre', 'sup_devices.num', 'ipadSc_urls.num', 'lang.num', 'vpp_lic', 'free_or_not']
['284882215', 'Facebook', '389879808', 'USD', '0.0', '2974676', '212', '3.5', '3.5', '95.0', '4+', 'Social Networking', '37', '1', '29', '1', 'free']
['389801252', 'Instagram', '113954816', 'USD', '0.0', '2161558', '1289', '4.5', '4.0', '10.23', '12+', 'Photo & Video', '37', '0', '29', '1', 'free']

The exactly same thing happens in the next screen, you just have more labels that you can use.

I hope I could help you now.

I’m sorry to give you the wrong information before. I think it looks better now.


Hi Otavios,

All of what you explain above makes absolute sense. And THANK YOU for the detailed explanation.

I guess my question still is why use the word ‘app’ here? The word app is neither in the list of lists (table) nor in the python language.

I tried writing the same code and replaced “app” for “xyz” in the entire code and I got an error.

Simply put my question is - is there a specific reason for the use of the word “app”? If so, what is that reason for the usage of the word “app”?

Your patience is much appreciated. Thank you.


1 Like

app is just a name. As you called the dataset apps_data, app looks like a good name for one unit of this dataset. And this is what the loop is doing: going trough the dataset one unity at a time:

Read the following line out loud and don’t think of it as code:

For app in apps

Do you see how it is a sentence that makes sense by itself? If your data was about types of cars, for example, and your dataframe was called cars, it would be expected from you to use the for loop like this:

For car in cars

This makes the code easy to read and understand. And keep in mind that the one reading it can be you twelve months from now :joy:

And yes, if you replace app for xyz in the entire code it will work. Don’t take my word for it, copy the following code and paste it in the mission and it will work.

opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)

for xyz in apps_data[1:]:
    price = float(xyz[4])
    if price == 0: