I have this method:
def filter_verdi_total_fruit_cost(file_name):
output = []
for token in file_name.split('\n'):
items = token.split()
if len(items) > 2 and items[1] in fruit_words:
output.append((items[1], items[-1]))
for _, v in output:
return v
print(filter_verdi_total_fruit_cost(verdi50))
And it prints just one value: 123,20.
But when I replace return v with: print(v)
it prints all the values, when I am calling the method: print(filter_verdi_total_fruit_cost(verdi50))
123,20
2.772,00
46,20
577,50
69,30
3.488,16
137,50
500,00
1.000,00
2.000,00
1.000,00
381,2
But this I don't understand. I just return v. and then it prints just one value. If I do a print(v) it prints all the values.
Question: How can I return all the values in the method, without the print statement?