Why sometimes for app in apps_data and sometimes for row in apps_data

hey there folks :slight_smile:
I am working through ‘Conditional statements’ and I don’t quite under why we sometimes need to use: ‘app’ and sometimes ‘row’

‘’‘for app in apps_data’’’
‘’‘for row in apps_data’’’

how do we know which to use? so that the code works?

thanks a mil folks :slight_smile:

It doesn’t really matter if you use app or row or even banana. The choice you make largely depends on what makes sense to you (makes the code readable and easier to think through). I have a few habits I’ve picked up over time when working with loops. When I am using loops to go through a list of lists (like apps_data), I tend to always use row because it reminds me that I’m looping through the rows. If I’m looping through a single list, I may use item or a more descriptive variable depending on what I know is in the list. If I’m looping through a list of index numbers, I tend to use i (or j for loops within loops). For dictionaries I tend to use key. No matter which way you go with it, it doesn’t affect the functionality, because it’s just a placeholder for a value, so go for readability.

2 Likes

thanks a mil for clearing this up for me :slight_smile: