You are viewing a single comment's thread. Return to all comments →
The first one should have used a list instead of dictionary:
def whatFlavors(cost, money): map = [] for pos in range(len(cost)): f1 = cost[pos] f2 = money - f1 if f2 in map: # print(f2) print(cost.index(f2) + 1, pos + 1) else: map.append(f1) #print(map)
Seems like cookies are disabled on this browser, please enable them to open this website
Hash Tables: Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
The first one should have used a list instead of dictionary: