I am new to python and trying to write a function that accepts a list of dictionaries and returns a new list of strings with the first and last name keys in each dictionary concatenated.
names = [{'first': 'John', 'last': 'Smith'}, {'first': 'Jessie', 'last': 'Snow'}]
def name_function(lst):
for name in lst:
return f"{name['first']} {name['last']}"
names_function(names)
'John Smith'
I wrote a for loop that iterates thru the list of dictionaries and returns an f-string that concatenates first and last name keys in each dictionary, however, the loop fails to iterate beyond the first key and I am hoping some one can point me to the issue.