Created
July 31, 2016 17:30
-
-
Save nathantowell/babb41e29aec039f33711fd44f95cf37 to your computer and use it in GitHub Desktop.
A simple function to order a list.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def max_of(list): | |
for a in reversed(range(1, len(list)+1)): | |
for b in range(1, a): | |
if list[b-1] > list[b]: | |
temp = list[b-1] | |
list[b-1] = list[b] | |
list[b] = temp | |
return list | |
#Example | |
print(max_of([5,9,12,7,4,5,15,75])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment