Q: Comparing columns in a list I have done splitting on the csv file(link given below) and my data output is given below. I need little help in comparing country column and return only the movie names that are made in the USA only. How do I do that?
data = open("movie_metadata.csv", "r").read().split("\\n")
movie_data = [i.split(",") for i in data]
print(movie_data[1:4])

output:
[['movie_title','director_name','color','duration','actor_1_name','language',
  'country','title_year'],
['Avatar','James Cameron','Color','178','CCH Pounder','English','USA',
 '2009'],
["Pirates of the Caribbean: At World's End",'Gore Verbinski','Color',
 '169','Johnny Depp','English','USA','2007'],
['Spectre','Sam Mendes','Color','148','Christoph Waltz','English','UK',
 '2015']]

CSV File

A: You want to filter the list based on the country column. 
us_movies = [movie for movie in movies if movie[6] == 'USA'] 

You can also transform the line into just the title if you like.
us_movie_titles = [movie[0] for movie in movies if movie[6] == 'USA']

If you want a corresponding list of match predicate results, this will work:
is_match = [movie[6] == 'USA' for movie in movies]

Note, the size of the first two lists may be smaller than the original list, but is_match will have the same size and ordering as your original list.
To add the booleans to your full dataset:
movies_with_usa = [m[0] + [m[1]] for m in zip(movies, is_match)]

But what you really have is named data, so it's probably more appropriate in a dictionary or object. Also, if you're reading a csv file, a csv reader is part of the standard library. So for something a little more robust
import csv

def read_data(filename):
    with open(filename) as f:
        reader = csv.DictReader(f)
        return [row for row in reader]     

def match(record, field, value):
    return record[field] == value

data = read_data("movie_metadata.csv")
us_movies = [record for record in data if match(record, 'country', 'USA')]      


A: You want to use a pandas dataframe and then you can filter very easily based on the columns.
import pandas as pd
df = pd.DataFrame(movie_data[1:],columns = movie_data[0])
                                movie_title   director_name  color duration     actor_1_name language country title_year
0                                    Avatar   James Cameron  Color      178      CCH Pounder  English     USA       2009
1  Pirates of the Caribbean: At World\'s End  Gore Verbinski  Color      169      Johnny Depp  English     USA       2007
2                                   Spectre      Sam Mendes  Color      148  Christoph Waltz  English      UK       2015

df[df.country == "USA"]
                                movie_title   director_name  color duration actor_1_name language country title_year
0                                    Avatar   James Cameron  Color      178  CCH Pounder  English     USA       2009
1  Pirates of the Caribbean: At World\'s End  Gore Verbinski  Color      169  Johnny Depp  English     USA       2007


A: Just iterate over all movies and compare the 7th column:
 made_usa = []   

 for l in movie_data:
        if l[6] == 'USA':
          made_usa.append(l)

 print (made_usa)

To add only the movie name, it is just to do this:
     made_usa = []   

     for l in movie_data:
            if l[6] == 'USA':
              made_usa.append(l[0])

      print (made_usa)

To save if there is a match or not, you can use a dictionary like this:
     made_usa = {}

     for l in movie_data:
            if l[6] == 'USA':
              made_usa.update({l[0]: 'True'})
            else:
              made_usa.update({l[0]: 'False'}) 
     print (made_usa)

After that, if you want to look if a certain move was made in USA or not. All you need to do is, for example:
print(made_usa['Avatar'])

Output:
'True'


A: Probably you are looking for a generic solution without any third party libraries (i.e. only standard library). Here we go:
def filter_by(csv_data, column_name, column_value):
    indices = [i for i, name in enumerate(data[0]) if name == column_name]
    if not indices:
        return
    index = indices[0]
    for row in data[1:]:
        if row[index] == column_value:
            yield row

And this is how you use it:
print(list(filter_by(movie_data, "country", "USA")))

This shall output (I formatted it a bit for clarity):
[
    ['Avatar', 'James Cameron', 'Color', '178', 'CCH Pounder', 'English', 'USA', '2009'],
    ["Pirates of the Caribbean: At World's End", 'Gore Verbinski', 'Color', '169', 'Johnny Depp', 'English', 'USA', '2007']
]

