Python Forum
Manual Sort without Sort function
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manual Sort without Sort function
#4
(Oct-13-2017, 03:01 AM)dtweaponx Wrote: The line numbers are you talking about up there in the code I posted or in python itself? Also is my if statement comparisons right? I’m kind of second guessing if I have it comparing correctly. Since it’s 3 if statements per input of line.
ichabod801 will be referring to the line numbers as shown in the post you made - we have no idea what line numbers might apply in the editor you are using elsewhere (but would expect them to be the same if you have pasted like-for-like).

I'm also struck that the assignment was to sort three numbers into ascending order, not to determine the lowest, middle and highest. You might want to do a google search for sort algorithms (look at bubble sort and quick sort).

I note you are checking for some redundant conditions. If you've already established that first is smaller than anything else, then you have no need to check within the block where that condition applies to see if the second is smaller than the first.

Incidentally, what happens if the user enters some numbers that are the same?
I am trying to help you, really, even if it doesn't always seem that way
Reply


Messages In This Thread
Manual Sort without Sort function - by dtweaponx - Oct-13-2017, 02:04 AM
RE: Manual Sort without Sort function - by gruntfutuk - Oct-13-2017, 08:18 AM
RE: Manual Sort without Sort function - by buran - Oct-13-2017, 08:29 AM
RE: Manual Sort without Sort function - by snippsat - Oct-13-2017, 02:58 PM
RE: Manual Sort without Sort function - by wavic - Oct-13-2017, 06:33 PM
RE: Manual Sort without Sort function - by Mekire - Oct-13-2017, 11:28 PM
RE: Manual Sort without Sort function - by wavic - Oct-14-2017, 01:05 AM
RE: Manual Sort without Sort function - by Mekire - Oct-14-2017, 01:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Frog codility leap sort variant MoreMoney 5 591 Apr-06-2024, 08:47 PM
Last Post: deanhystad
  How to sort a list with duplicates and return their unique indices. Echoroom 3 3,606 Sep-23-2022, 07:53 AM
Last Post: deanhystad
  sorting a list using unicodes acending order, no loops, no sort(), using recursion lrn2codee 14 6,567 Jun-23-2021, 07:33 PM
Last Post: deanhystad
  Sort and merge flintstone 1 1,952 Jun-14-2021, 07:32 PM
Last Post: Larz60+
  How can I sort my column so that NaN is at the bottom? soft 3 2,473 Feb-06-2021, 01:02 PM
Last Post: ibreeden
  how to sort a list without .sort() function letmecode 3 3,510 Dec-28-2020, 11:21 PM
Last Post: perfringo
  Sort on basis of (name,age,score) pyzyx3qwerty 9 9,711 May-14-2020, 08:29 AM
Last Post: pyzyx3qwerty
  Sort last pyzyx3qwerty 7 4,855 May-05-2020, 02:58 PM
Last Post: DeaD_EyE
  insertion sort brobro 3 2,259 Apr-24-2020, 01:29 PM
Last Post: Godserena
  Sort objects by protected properties. Sigriddenfeta 1 1,928 Mar-17-2020, 04:11 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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