Marco Rovere (3) [Avatar] Offline
the code in listing 2.1, that is supposed to compute the inner product between 2 vectors is wrong, since it does more combinations that actually needed: it combines all indices, while the inner only combines identical ones.

revenue = 0
#maybe also a check on len(costs) == len(amounts)....
for i in range(len(costs)):
  revenue += costs[i]*amounts[i]

Nishant Shukla (52) [Avatar] Offline
Thanks Marco,

You're right. I was just testing if you were paying attention.

Just kidding - fatal mistake on my part. It will be fixed soon.