I've written this code, and I want to be able to use the dictionary I created in the function as an argument for another function but I can't seem to print it on it's own, or use it as an argument as 'names is not defined'. How do I create the same output (a list of dictionaries with dictionaries as values) but also being able to use the dictionary outside of the function?
def get_name(string_input):
l = [line.split('is connected to') for i, line in enumerate(string_input.split('.')) if i % 2 == 0]
names = {name[0]:{} for name in l}
return names
print get_name(example_input)
print names