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

In python why do i get an syntax error, where i give the value to a variable? Here in this program i get error with , it says syntax error. x = 25 epsilon = 0.01 numGuesses = 0 ans = 0.0 while abs(ans**2 - x) >= epsilon and ans <= x: ans += 0.00001 numGuesses += 1 print 'numGuesses =', numGuesses if abs(ans**2 - x) >= epsilon: print 'Failed on square root of', x else: print ans, 'is close to square root of', x

OpenStudy (anonymous):

The only error I can see is that you don't have indentation. Look here: http://docs.python.org/release/2.5.1/ref/indentation.html

OpenStudy (anonymous):

works for me - http://dpaste.com/1151240/

OpenStudy (anonymous):

Thanks a lot !

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!