Nov-08-2021, 11:50 PM
OK thanks, then I did the following code:
def main(list_1): return main list_1 = [ {'name': 'Jerome', 'weight': 3.38, 'wingspan': 49.96, 'length': 19.75}, {'name': 'Ibraheem', 'weight': 3.08, 'wingspan': 50.59, 'length': 20.6}, {'name': 'Tiana', 'weight': 0.81, 'wingspan': 47.86, 'length': 17.94}, {'name': 'Lucas', 'weight': 3.33, 'wingspan': 48.27, 'length': 18.77}, {'name': 'Rickie', 'weight': 4.4, 'wingspan': 51.0, 'length': 20.34} ] def get_data(data,key): y=[] for x in data: return y=x[key] data = list_1 get_data(list_1,'length') output = get_data(data,key) print(output, end=" ")I'm getting a syntax error in "return y=x[key]", why is that?