# Python Conditional Statements
To implement the condition above (If the price is equal to 0.0, then do:) in our code, we can use an if statement:

test
```python=
# INITIAL CODE
opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
free_apps_ratings = []
for row in apps_data[1:]:
rating = float(row[7])
price = float(row[4])
if price == 0.0:
free_apps_ratings.append(rating)
avg_rating_free = sum(free_apps_ratings) / len(free_apps_ratings)
```
* Create an empty list named free_apps.
* Iterate over app_and_price. For each iteration, we:
* Extract the name of the app and assign it to a variable named name.
* Extract the price of the app and assign it to a variable named price.
* Append the name of the app to free_apps (the empty list that we initialized outside the loop) if the price of the app is equal to 0.

test
```python=
opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
non_games_ratings = []
for row in apps_data[1:]:
rating = float(row[7])
genre = row[11]
if genre != 'Games':
non_games_ratings.append(rating)
avg_rating_non_games = sum(non_games_ratings) / len(non_games_ratings)
```

Note, however, that the logic is different when we use an else clause. For elif price >= 50, app.append('very expensive') will be executed only if the price is greater than or equal to 50. For else, there's no condition to be met (other than the previous if and elif clauses resolving to False), and app.append('very expensive') will be executed even if the price has a value of -5 or -100.

test
```python=
# 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:]:
price = float(app[4])
if price == 0.0:
app.append('free')
elif price > 0.0 and price < 20 :
app.append('affordable')
elif price >= 20 and price < 50 :
app.append('expensive')
elif price >= 50 :
app.append('very expensive')
apps_data[0].append('price_label')
print (apps_data[:6])
```
###### tags: `python`