Where was 'app' defined?

I’m confused by the use of “app” in this code:

INITIAL CODE

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

for app in apps_data[1:]:

Up to this point we have written:
for row in apps_data[1:]

How is ‘app’ a substitute for ‘row’?

Thanks!

Hi @everydaybest

What happens is that in For loops you use an iterator (or a helper) to iterate through a list or file.
That iterator or helper, can have any name but it is ideal that the name has a relationship with whatever you’re going to do

In this case both row and app are the iterator/helper.

Hope this helps you to understand, if not please let me know
Good luck!

2 Likes

Hello @everydaybest,

You can also take a look at this topic:

3 Likes