[Solved] Can anyone help me what is wrong in my code? [closed]


That depends on your input.

If, in one call to order, x[0] is the biggest item by ranks, you get all the items in the list copied to r, and you’re calling order with exactly the same arguments again. This causes an infinite recursion and at some point (level 1000) it triggers Python’s max recursion error.

Try excluding x[0] by for y in x[1:] and inserting x[0] into the results.

1

solved Can anyone help me what is wrong in my code? [closed]