Friends what's wrong with this code: def evaluatePoly(poly, x): ''' Computes the value of a polynomial function at given value x. Return that value as a float. poly: list of numbers, length > 0 x: numbers returns: float ''' if (len(poly)== 0): return float(0) result = float(poly[0]) index = 1 while index!=len(poly): result += poly[index]*x**index index += 1 return result
The indentation of the while block and the final "return" statement!
please use a code pasting site: - http://dpaste.com - http://pastebin.com - http://www.repl.it/ - http://pastie.org - http://codepad.org - http://ideone.com paste your code there and post the link here. select Python syntax highlighting when u paste.
Join our real-time social learning platform and learn together with your friends!