def square_soft(input_list):
 squared = []
 neg = [(x ** 2) for x in input_list if (x < 0)]
 pos = [(x ** 2) for x in input_list if (x >= 0)]
 neg.reverse()
 while (len(squared) != len(input_list)):
  if (not neg):
   squared.extend(pos)
  elif (not pos):
   squared.extend(neg)
  elif (pos[0] >= neg[0]):
   squared.append(neg.pop(0))
  else:
   squared.append(pos.pop(0))
 return squared

def square_soft ( input_list ) : squared = [ ] neg = [ ( x ** 2 ) for x in input_list if ( x < 0 ) ] pos = [ ( x ** 2 ) for x in input_list if ( x >= 0 ) ] neg . reverse ( ) while ( len ( squared ) != len ( input_list ) ) : if ( not neg ) : squared . extend ( pos ) elif ( not pos ) : squared . extend ( neg ) elif ( pos [ 0 ] >= neg [ 0 ] ) : squared . append ( neg . pop ( 0 ) ) else : squared . append ( pos . pop ( 0 ) ) return squared
returns a list with all values squared and sorted .