Just started coursework and stuck on first exercise. "Positive root of the following equation: 34*x^2+68*x-510". I figured out that I can assign a number to X but is there a way to assign an open variable to X in order to run the equation (e.g. x = ?)?
I have no idea what you are talking about I just started, so if you figure this out you might be able to help me
which problem set are you referring to?
Based strictly on your question, I think you are asking for an input for x? Basically, x=print("Give x a value:").
He's referring to the 'Introduction to Python' handout that has a few problems in Python for you just to get you started using the language.
um... are you sure your doing 6.00? the first pset is merely asking for input and printing it back out
seriously, you shouldn't worry yourself over that problem. IT DOESNT MATTER!!!!!!!!! get on with the lectures and psets and you will learn everything you need to know in due time.
import math print "a*x^2 + b*x + c = 0" a = float(raw_input("a = ")) b = float(raw_input("b = ")) c = float(raw_input("c = ")) x1 = ((-b + math.sqrt(b*b - 4*a*c))/(2*a)) x2 = ((-b - math.sqrt(b*b - 4*a*c))/(2*a)) print "x1 =", x1 print "x2 =", x2 Run as a module
its simple...we know that roots of a equation can be found as [-b +or- sqrt(b^2 -4*ac)]/2ac.......solving which we get the roots as 3 and -5......simple...so i guess ur root must be 3.
Join our real-time social learning platform and learn together with your friends!