Last active
October 10, 2016 22:59
-
-
Save ugofred/12185d83ff5857792802e2568089fd90 to your computer and use it in GitHub Desktop.
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 lsp_range(lsp): | |
if len(lsp) == 1: | |
return [lsp[0]] | |
sm = lsp[0] | |
lg = lsp[0] | |
for i in lsp: | |
if i > lg: | |
lg = i | |
elif i < sm: | |
sm = i | |
return [sm, lg] | |
def nex_range(lsp_): | |
nulsp = lsp[:] | |
all_ = lsp_range(nulsp) | |
nulsp.remove(range_[0]) | |
nulsp.remove(range_[1]) | |
return lsp_range(nulsp) | |
def sort_asc_dsc(lsp): | |
nulsp = lsp[:] | |
midlsp = len(nulsp) / 2 | |
sort_ = [] | |
z = 0 | |
while z < midlsp: | |
all_ = lsp_range(nulsp) | |
sort_.insert(midlsp + z, all_[1]) | |
sort_.insert(z, all_[0]) | |
nulsp.remove(all_[0]) | |
nulsp.remove(all_[1]) | |
z = z + 1 | |
if len(nulsp) == 1: | |
sort_.insert(midlsp,nulsp[0]) | |
else: | |
pass | |
return sort_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment