python - Using accumulate function to sort list (higher order function) -


  DIF accumulated (FN, initial, CEC): if CEC == (): Return to initial: returns FN (CEC [0], Consolidate (FN, Initial, CEC [1:]) Using   

Submit I have to type a sorting function.

  def insertion_sort_hof (tup): return deposit (lambda x, y: x, y = y, x if x> y and none, (), tup)   

This is my code and I do not think it is capable of running. Why?

  Insertion_saort_hf (()) # () Combination_sort_hoff ((19,10,1,4,3,1,3, 2)) # (1, 1, 2, 3, 3, 4, 10, 19)  

There can be no assignment in a lambda, Therefore, try to add brackets such as lambda is invalid and you will get an error message for that error:

  lambda x, y: (x, y) = (y, x) if X & gt; Nothing else   

And it will not work anyway, because you swipe only local levels on that function.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -