I want input to be actorsInCommon(movies, "Moneyball", "Oceans Eleven")
I want output to be ["Brad Pitt", "Joe Smith"]
movies = {"Moneyball": ["Brad Pitt", "Jonah Hill", "Joe Smith"],
"Oceans Eleven": ["Brad Pitt", "Joe Smith", "George Clooney"]}
def find(key, dictionary):
for (k, value) in dictionary:
if key == k:
return value
return None
def actorsInCommon(dictionary, movie1, movie2):
movie1Cast = find(movie1, dictionary)
movie2Cast = find(movie2, dictionary)
return list(set(movie1Cast).intersection(movie2Cast))