Python Forum
Help with a custom function needed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a custom function needed
#2
XlistS = reversed(sorted(Xlist))
XlistS is iterator. That is what reversed() built-in function returns. After first iteration of the loop it is exhausted (i.e. empty).
you can do
XlistS = Xlist[::]
XlistS.sort(reverse=True)
Also looking at 2-16 and 17-32, it's clear the need of another function.
Reply


Messages In This Thread
RE: Help with a custom function needed - by buran - Nov-03-2017, 08:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 604 Nov-23-2023, 02:53 PM
Last Post: rob101
  Custom function that prints function text gyaan_anveyshak 3 2,113 Jan-28-2020, 05:43 AM
Last Post: perfringo
  Custom Function to Return Database Values rm78 0 1,786 Sep-05-2019, 01:01 PM
Last Post: rm78
  Duplicate output when calling a custom function from the same file? road2knowledge 2 2,398 May-10-2019, 07:58 AM
Last Post: road2knowledge

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020