Python Forum
[split] Manual Sort without Sort function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Manual Sort without Sort function
#1
#Get user input
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))
c = int(input("Enter the third number: "))
 
small = 0
middle = 0
large = 0
 
# IF Statement
#SMALL
if a < b and a < c:
    small = a
elif b < a and b < c:
    small = b
else:
    small = c

 
#MIDDLE
if (a < b  and  b < c) or ( c < b  and  b < a):
   middle = b
elif( b < a  and a < c )or (c < a  and a < b):
    middle = a
elif (a < c  and c < b) or (b < c  and c < a)we:
    middle = c

    
#LARGE
if a > b and a > c:
    large = a
elif b > a  and b > c:
    large = b
else:
    large = c
 
 
 
# Display Results
print("The numbers in accending order are: ", large, middle, small)
Reply


Messages In This Thread
[split] Manual Sort without Sort function - by fulir16 - Jun-01-2019, 01:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Frog codility leap sort variant MoreMoney 5 888 Apr-06-2024, 08:47 PM
Last Post: deanhystad
  How to sort a list with duplicates and return their unique indices. Echoroom 3 3,788 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,850 Jun-23-2021, 07:33 PM
Last Post: deanhystad
  Sort and merge flintstone 1 1,999 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,556 Feb-06-2021, 01:02 PM
Last Post: ibreeden
  how to sort a list without .sort() function letmecode 3 3,606 Dec-28-2020, 11:21 PM
Last Post: perfringo
  Sort on basis of (name,age,score) pyzyx3qwerty 9 9,896 May-14-2020, 08:29 AM
Last Post: pyzyx3qwerty
  Sort last pyzyx3qwerty 7 5,088 May-05-2020, 02:58 PM
Last Post: DeaD_EyE
  insertion sort brobro 3 2,345 Apr-24-2020, 01:29 PM
Last Post: Godserena
  [split] problem with function return value ops 1 3,518 Apr-13-2020, 01:48 PM
Last Post: buran

Forum Jump:

User Panel Messages

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