Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wonder_woman = ['Wonder Woman','Patty Jenkins','Color',141,'Gal Gadot','English','USA',2017]
- def is_usa(input_lst):
- if input_lst[6] == "USA":
- return True
- else:
- return False
- def index_equals_str(input_lst, index, input_str):
- if input_lst[index] == input_str:
- return True
- else:
- return False
- wonder_woman_in_color = index_equals_str(input_str="Color", index=2, input_lst=wonder_woman)
- # End of dataquest challenge
- # My own try to use the function in a loop and add the results to a list
- f = open("movie_metadata.csv", "r")
- data = f.read()
- rows = data.split("\n")
- aufbereitet = []
- for row in rows:
- einmalig = row.split(",")
- aufbereitet.append(einmalig)
- # print(aufbereitet)
- finale_liste = []
- for item in aufbereitet:
- test = index_equals_str(input_str="Color", index=2, input_lst=aufbereitet)
- finale_liste.append(test)
- print(finale_liste)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement