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

hey, so i'm at the python Shell i did "import math" and now i'm trying to do the exercise but it says "Traceback (most recent call last): File "", line 1, in 34*x^2+68*x-510 NameError: name 'x' is not defined" what am i doing wrong? Thanks, take care.

OpenStudy (amistre64):

i would say you are not properly defining "x"

OpenStudy (amistre64):

can you post your code?

OpenStudy (anonymous):

i just wrote 34*x^2+68*x-510 directly i did the import math before and after that i just did 34*x^2+68*x-510 how can i define x? i'm really new at this

OpenStudy (anonymous):

oh i did it, it was so simple, thanks anwyay for your time :)

OpenStudy (rsmith6559):

Python doesn't use the carat ( "^" ) character for exponents. Python uses "**" so your answer isn't correct. >>> x = 2 >>> x ^ 4 6 >>> x ** 4 16

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!
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!