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

I just began the course yesterday and am very new to this. The very first question "Positive root of the following equation: 34*x^2 + 68*x - 510" is giving me problems. After some research, I put in "positive_root = (34*x^2 + 68*x - 510)" but received the error that x is not defined. Dumb question I'm sure, but you have to start somewhere.

OpenStudy (anonymous):

use descriminant formula-->x=(-b+math.sqrt(b**2+4*a*c)/2*a where a*x**2+b*x+c=0 remember there are two answers one written above another is the same exceppt we change sign -math.sqrt(...).Also don't forget to type from math import * .Hope it helps.

OpenStudy (anonymous):

Thanks so much. I will check it out and let you know.

OpenStudy (anonymous):

The other thing I notice is the error that x is not defined come from the fact that you used a variable before declaring it. You have to initialize x before using it in an expression.

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!