I wrote this code to calculate the amount spent on certain products of a kind. I don\'t know why but the code I wrote is giving me an error "Exception in thread "m