Aug-10-2020, 05:26 PM
I need to know what is the syntax error in this python code. I am using python 3.5.
http://heather.cs.ucdavis.edu/~matloff/pudb.html
They seem to have no problem with the python interpreter.
Any help appreciated. Thanks in advance.
Respectfully,
ErnestTBass
# example program to demonstrate PuDB debugger; finds insertion point in # a sorted list def findinspt(x,xnew): # returns insertion point of xnew in x n = len(x) lo = 0 hi = n-1 while True: mid = (lo + hi) / 2 if xnew > x[mid]: lo = mid + 1 else: hi = mid if xnew == x[mid]: return mid y = [5,12,13] print findinspt(y,3) print findinspt(y,8) print findinspt(y,12) print findinspt(y,30)The error is:
Error:File "<ipython-input-1-46fa0bca0f9d>", line 15
print findinspt(y,3)
^
SyntaxError: invalid syntax
It came from this linkhttp://heather.cs.ucdavis.edu/~matloff/pudb.html
They seem to have no problem with the python interpreter.
Any help appreciated. Thanks in advance.
Respectfully,
ErnestTBass