• anonymous
Question re: PS2, Problem One My solution to this problem ended up being similar to the given solution, except instead of iterating the for loop through range(0,len(poly)), I choose to iterate directly through "poly". However, this threw an error: "tuple indices must be integers". My plan was that "for i in poly" would go through each indice in the tuple and assign that particular "i" the value of that indice. I had set up the code to multiply the value of poly[i] by x and then raise it to the value of the indice represented by "i". I didn't think I was modifying the value of the indice
MIT 6.00 Intro Computer Science (OCW)
  • katieb
I got my questions answered at in under 10 minutes. Go to now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly


Get your free account and access expert answers to this
and thousands of other questions

  • anonymous
it seems to be saying that you are looking for element tuple[1.5], a fractional index into the tuple. without seeing any code, it's only a guess.
  • anonymous
My code was: def evaluate(poly, x): for i in poly: print i sum =+ ((poly[i]*x)*i) print sum and then the value of "poly" was whatever the problem indicated it was, a bunch of floats. i think i assumed that "i" would take the indice value of the tuple, rather than the actual value at that indice.
  • harsimran_hs4
what you are doing is perhaps picking up the index and multiplying it by x and the multiplying this product further by the power of x the wrong part is that the value of poly[i] i.e eg 3x2 so in your solution even 3 is getting raised to the power perhaps you should do something like poly[i] * (x**i) well i don`t explain perfectly anything unclear please do ask... i hope this helps!

Looking for something else?

Not the answer you are looking for? Search for more explanations.