You are viewing a single comment's thread. Return to all comments →
Without any module:
N = int(input()) item_name= [] price_list =[] for _ in range(N): *item, price = input().split() item_name.append(' '.join(item)) price_list.append(int(price)) unique_item= [] unique_price= [] for item, price in zip(item_name, price_list): if item not in unique_item: unique_item.append(item) unique_price.append(price) else: ind= unique_item.index(item) unique_price[ind]= unique_price[ind]+ price for item, total_price in zip(unique_item, unique_price): print(item, total_price)
Seems like cookies are disabled on this browser, please enable them to open this website
Collections.OrderedDict()
You are viewing a single comment's thread. Return to all comments →
Without any module: