Guest User

Untitled

a guest
Dec 3rd, 2022
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. a = [78, -32, 5, 39, 58, -5, -63, 57, 72, 9, 53, -1, 63, -97, -21, -94, -47, 57, -8, 60, -23, -72, -22, -79, 90, 96, -41, -71, -48, 84, 89, -96, 41, -16, 94, -60, -64, -39, 60, -14, -62, -19, -3, 32, 98, 14, 43, 3, -56, 71, -71, -67, 80, 27, 92, 92, -64, 0, -77, 2, -26, 41, 3, -31, 48, 39, 20, -30, 35, 32, -58, 2, 63, 64, 66, 62, 82, -62, 9, -52, 35, -61, 87, 78, 93, -42, 87, -72, -10, -36, 61, -16, 59, 59, 22, -24, -67, 76, -94, 59]
  2.  
  3. n = len(a)
  4.  
  5. for i in range(n):
  6. minim = a[i]
  7. for j in range(n - i - 1):
  8. if a[j + i + 1] < minim:
  9. minim = a[j + i + 1]
  10. minim_index = a.index(minim)
  11. a[i], a[minim_index] = a[minim_index], a[i]
  12.  
  13. print(a)
Advertisement
Add Comment
Please, Sign In to add comment