Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MyList = [83, 8, 44, 6, 28, 71, 41, 91, 9, 23]
- MaxIndex = len(MyList) - 1 # 9 here
- n = MaxIndex
- for i in range(0, MaxIndex): # Pass number
- for j in range(n): # all the way to 8, because range(9) goes to 8
- if MyList[j] > MyList[j + 1]:
- Temp = MyList[j]
- MyList[j] = MyList[j + 1]
- MyList[j + 1] = Temp
- n = n - 1
- print("Pass Number: ", i + 1, "; MyList: ", MyList) # human counting
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement