Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 13 Online
OpenStudy (anonymous):

On Problem Set 2 Question 1, I can't get the inter active mode to print out the function. If I input something like: >>> poly = (0.0, 0.0, 5.0, 9.3, 7.0) >>> x = -13 >>> print evaluate_poly(poly, x) 180339.9 But instead it says something like Traceback (most recent call last): File "", line 1, in print evaluate_poly(poly, x) NameError: name 'evaluate_poly' is not defined Not sure what I'm doing wrong, any thoughts? Its probably something ridiculously simple!

OpenStudy (rsmith6559):

Assuming that you posted the entire session, either evaluate_poly() will need to be typed in before those three lines, or it will need to imported from a file: from whateverFile import evaluate_poly

OpenStudy (anonymous):

Ok, well that is good to know. Python is still a little weird to me with this whole interactive mode. I wasn't importing or typing in the code for the evaluate_ploy(). Once I did that it worked like a charm! Thanks!

OpenStudy (rsmith6559):

During testing/debugging, trying something new, the interactive is great. It's actually a shell environment, separate from writing a file and then executing it.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!