Answers for "TypeError Traceback (most recent call last) <ipython-input-29-d94abd685d4c> in <module> 11 for i in range (0,N): 12 i=N/2 ---> 13 if list[i]==x : 14 print (i) 15 found=True TypeError: 'type' object is not subscriptable"

0

TypeError Traceback (most recent call last) <ipython-input-29-d94abd685d4c> in <module> 11 for i in range (0,N): 12 i=N/2 ---> 13 if list[i]==x : 14 print (i) 15 found=True TypeError: 'type' object is not subscriptable

List = [1,4,5,7,9,15]
N=len(List)
x=9

print ("List=",List)
print ("N=len(List)=",N)
print ("Searching for x=",x)
found = False

print ("Starting recursive algorithm:")
for i in range (0,N):
    i=N/2
    if list[i]==x :
        print (i)
        found=True
    elif (list[i]<x | list[i]>x) :
        i=i/2
        if list[i]==x :
             print (i)
             found=true
Posted by: Guest on October-01-2021

Code answers related to "TypeError Traceback (most recent call last) <ipython-input-29-d94abd685d4c> in <module> 11 for i in range (0,N): 12 i=N/2 ---> 13 if list[i]==x : 14 print (i) 15 found=True TypeError: 'type' object is not subscriptable"

Python Answers by Framework

Browse Popular Code Answers by Language