313-3 Conditional Statements: for statement

Hello all,

I’m starting on the Data Analyst for Python course, and I’m on Introduction to Python: Conditional Statements.

In the lesson, there’s a line stating:

for app in app_and_price:

I’ve only seen for row in… so far, so I’m wondering is it because the data at the top isn’t in a table format, therefor there’s no rows? Are the names of the apps recognized as “app” in the for statement? Any help would be appreciated. Thanks!

Hi Ray,

Of course you can use “for row in” if you want. You can even use “for Ray in”. The idea is to refer to the elements of the list by a random name. “row” is simply the name of choice of DQ. Many times, I personally find it useful to use a name that is similar to the list or dataframe I’m working with. So for instance, if I’m working with a table or list of currencies, I would likely write “for currency on”. In your case here, you have a list of lists that refer to apps and their prices hence the use of “for app in”. Good luck

1 Like

Ok cool. Initially I thought “row” was a specific code word to refer to each row in a table. I didn’t know that “row” in the “for” statements was interchangeable and not assigned to something in particular in coding. Thank you for helping out.

1 Like