PYTHON   25

sorter with for

Guest on 13th November 2021 06:35:55 AM

  1. a=[float(input("enter a number ")),float(input("enter a number ")),float(input("enter a number "))]
  2.  
  3.  
  4. b=[float(0),float(0),float(0)]
  5.  
  6. print(a)
  7.  
  8. for x in range (3):
  9.  if b[0] < a[x]:
  10.   b[0]=a[x]
  11.  
  12.  
  13.  
  14. for x in range (3):
  15.  if b[0] > a[x] and b[1] < a[x]:
  16.   b[1]=a[x]
  17.  
  18.  
  19. for x in range (3):
  20.  if b[0] > a[x] and b[1] > a[x] and b[2] < a[x]:
  21.   b[2]=a[x]
  22.  
  23. print(b)

Raw Paste


Login or Register to edit or fork this paste. It's free.