Skip to content

Commit

Permalink
Apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbotello committed Jan 11, 2017
1 parent 0298943 commit a096468
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions challenge_9/python/alexbotello/src/square.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ def square_soft(input_list):
"""
Returns a list with all values squared and sorted
"""

squared = []

# Separate negative and positive values
Expand All @@ -18,15 +17,15 @@ def square_soft(input_list):
while len(squared) != len(input_list):
# Add the rest of pos array if neg is empty
if not neg:
squared.append(pos.pop(0))
squared.extend(pos)
# Add the rest of neg array if pos is empty
elif not pos:
squared.append(neg.pop(0))
squared.extend(neg)

elif pos[0] >= neg[0]:
squared.append(neg.pop(0))

elif neg[0] >= pos[0]:
else:
squared.append(pos.pop(0))

return squared
Expand Down

0 comments on commit a096468

Please sign in to comment.