Created
October 13, 2016 22:55
-
-
Save itzbernoulli/780d6d00deeb4240d439cf310eaaeaa7 to your computer and use it in GitHub Desktop.
Another class activity
This file contains hidden or 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
arr = [1,4,5,6,7,3,2] | |
#This is a program that creates an alternate sort for an array | |
def alternate_sort(arr): | |
f = sorted(arr) | |
d = [] | |
for i in range(1,(len(arr)/2)+1): | |
d.append(f[i-1]) | |
d.append(f[-i]) | |
return d | |
print alternate_sort(arr) |
This file contains hidden or 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
Eric Ondenyi (Kenya) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment