Blue Week Special Offer | Brighten your week!
days
hours
minutes
seconds

New column add questions

Screen Link: Learn data science with Python and R projects

My 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:]:
price = float(app[4])
# Complete code from here

if price == 0.0:
    app.append('free')
else:
    app.append('non-free')

apps_data[0].append(‘free_or_not’)
print(apps_data[6:])

How can I know ‘free’ /‘non-free’ is definitely under the header of ‘fee_or_not’ column?

You can print out the values in that column and check them. As you progress with the courses you will work with some libraries that will make it easier to do that check, but as of now, just print out those values and manually check them.

Of course, with too many rows, that will be a tedious task. So, you can create a simple for loop, that iterates over all the rows and checks if the value under that column is free or non-free. You can have it print the value if it’s neither of those two.