I wonder how to add elements that exist during the list tour.
Asked 2 weeks ago, Updated 2 weeks ago, 2 views
data_list = [[apple, 5], [grape, 3], [apple, 2]]
result_data = 
check_list = 
for item in data_list:
if item not in check_list:
for result_item in result_data:
if result_item == item:
result_item += item
If you find the same fruit on the list and add the number, it will take too long if you have a large number of elements on the list. How do I fix the code to do it quickly without doing it like that?