Advertisement
Matvey_Borisov

Untitled

Oct 22nd, 2020
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. arr=[5,65,77,35,21,67,9,40]
  2. arr1=[5,65,77,35,21,67,9,40]
  3. arr2=[5,65,77,35,21,67,9,40]
  4. n=len(arr)-1
  5.  
  6. i=n
  7. k=0
  8.  
  9. while(i>=0):
  10.     arr1[i]=arr[k]
  11.     k=k+1
  12.     i=i-1
  13.     arr2[i]=arr2[i-1]
  14. for i in range(n):
  15.     for k in range(n):
  16.         if arr[k]>arr[k+1]: arr[k],arr[k+1]=arr[k+1],arr[k]
  17. print(arr1)
  18. print(arr2)
  19. print(arr)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement