Python Forum
set and sorted, not working how expected!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set and sorted, not working how expected!
#3
Do it in the other order. Create a set from them if you want to remove duplicates, then sort it (into a list) if you want a particular order.

a2 = sorted(set(a))
Reply


Messages In This Thread
set and sorted, not working how expected! - by wtr - Jan-07-2022, 01:31 PM
RE: set and sorted, not working how expected! - by bowlofred - Jan-07-2022, 04:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python trivial endgame engine is not working as expected max22 0 609 Feb-24-2024, 04:41 PM
Last Post: max22
  Simple conditional not working as expected return2sender 8 1,107 Aug-27-2023, 10:39 PM
Last Post: return2sender
  Custom method to handle exceptions not working as expected gradlon93 3 1,117 Dec-22-2022, 07:12 PM
Last Post: deanhystad
  Failing to print sorted files tester_V 4 1,382 Nov-12-2022, 06:49 PM
Last Post: tester_V
Exclamation My code is not working as I expected and I don't know why! Marinho 4 1,164 Oct-13-2022, 08:09 PM
Last Post: deanhystad
  How to make elements return sorted? notsoexperienced 4 3,321 Sep-24-2020, 09:00 AM
Last Post: perfringo
  Why is my original list also sorted? Pedroski55 1 1,661 Jul-15-2020, 09:25 PM
Last Post: Yoriz
  Outputting Sorted Text files Help charlieroberrts 1 1,829 Jul-05-2020, 08:37 PM
Last Post: menator01
  append not working as expected teachinggeek 2 2,338 Apr-09-2020, 04:32 AM
Last Post: buran
  sorted function example mystery sabaidii2 4 2,658 Feb-10-2020, 09:37 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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