python - TypeError: 'function' object is not subscriptable in sorting algorithm -


i creating program in python designed organise list, have been using insertion sort method, when execute program, after have input list top organise, returned error "typeerror: 'function' object not subscriptable" code below:

def listsort(x):     in range(1,len(list)):         value = list[index]         = index - 1          while i>=0:             if value < list[i]:                  list[i+1] = list[i]                  list[i] = value                  = - 1              else:                 break 

please me understand have gone wrong here people, it's frying brain....

list() python function.

you can't index functions.

considering using different variable name. (like x since seems list trying sort)

it's worth noting sort() , sorted() functions may use, learning sorting methods practice.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -