Recursive function that takes in one list and returns two lists












2














I am asked to define a recursive function that takes in a list and then assigns the values of that list among two other lists in such a way that when you take the sum of each of those two lists you get two results that are in close proximity to each other.



Example:



If I run:



print(proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41]))


I get back two lists :



[31, 27, 21, 9, 8]          #sum = 96

[41, 24, 17, 8, 5] #sum = 95


This is how I did it, however I can't get my head around understanding how to return two lists in a recursive function. So far I was comfortable with conditions where I had to return one list.



This is my code so far:



def proximity_lists(lst, lst1 = , lst2 = ):
"""
parameters : lst of type list;
returns : returns two lists such that the sum of the elements in the lst1
is in the proximity of the sum of the elements in the lst2
"""
if not lst:
if abs(sum(lst1)-sum(lst2)) in range(5):
return lst1, lst2
else:
return {Not sure what to put here} + proximity_lists(lst[1:])


As far as range() goes, it can take anything for an argument as long as it's the closest they can get in the proximity of each other. I picked 5 because based on the example output above the difference between them is 1.



I need to add that this has to be done without the help of any modules.It has be done using simple functions.










share|improve this question
























  • List always even? Sublist always same size? Minimum sublist size? I mean [8] and [8] could be the best fit.
    – iGian
    Nov 12 '18 at 21:27










  • Such conditions weren't specified, so I guess anything goes as long as the sum of the two lists lie in the closest proximity of each other.
    – user10158754
    Nov 12 '18 at 21:29










  • Sorry, can you please ask a specific question. I understand your example and what has been asked of you but please just state a question which part of it you want help with.
    – trs
    Nov 12 '18 at 21:29










  • @trs I put out my code in order to get some insight on what to do in order to get that output
    – user10158754
    Nov 12 '18 at 21:30












  • Try start from here: stackoverflow.com/questions/27974126/…
    – iGian
    Nov 12 '18 at 21:32
















2














I am asked to define a recursive function that takes in a list and then assigns the values of that list among two other lists in such a way that when you take the sum of each of those two lists you get two results that are in close proximity to each other.



Example:



If I run:



print(proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41]))


I get back two lists :



[31, 27, 21, 9, 8]          #sum = 96

[41, 24, 17, 8, 5] #sum = 95


This is how I did it, however I can't get my head around understanding how to return two lists in a recursive function. So far I was comfortable with conditions where I had to return one list.



This is my code so far:



def proximity_lists(lst, lst1 = , lst2 = ):
"""
parameters : lst of type list;
returns : returns two lists such that the sum of the elements in the lst1
is in the proximity of the sum of the elements in the lst2
"""
if not lst:
if abs(sum(lst1)-sum(lst2)) in range(5):
return lst1, lst2
else:
return {Not sure what to put here} + proximity_lists(lst[1:])


As far as range() goes, it can take anything for an argument as long as it's the closest they can get in the proximity of each other. I picked 5 because based on the example output above the difference between them is 1.



I need to add that this has to be done without the help of any modules.It has be done using simple functions.










share|improve this question
























  • List always even? Sublist always same size? Minimum sublist size? I mean [8] and [8] could be the best fit.
    – iGian
    Nov 12 '18 at 21:27










  • Such conditions weren't specified, so I guess anything goes as long as the sum of the two lists lie in the closest proximity of each other.
    – user10158754
    Nov 12 '18 at 21:29










  • Sorry, can you please ask a specific question. I understand your example and what has been asked of you but please just state a question which part of it you want help with.
    – trs
    Nov 12 '18 at 21:29










  • @trs I put out my code in order to get some insight on what to do in order to get that output
    – user10158754
    Nov 12 '18 at 21:30












  • Try start from here: stackoverflow.com/questions/27974126/…
    – iGian
    Nov 12 '18 at 21:32














2












2








2


1





I am asked to define a recursive function that takes in a list and then assigns the values of that list among two other lists in such a way that when you take the sum of each of those two lists you get two results that are in close proximity to each other.



Example:



If I run:



print(proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41]))


I get back two lists :



[31, 27, 21, 9, 8]          #sum = 96

[41, 24, 17, 8, 5] #sum = 95


This is how I did it, however I can't get my head around understanding how to return two lists in a recursive function. So far I was comfortable with conditions where I had to return one list.



This is my code so far:



def proximity_lists(lst, lst1 = , lst2 = ):
"""
parameters : lst of type list;
returns : returns two lists such that the sum of the elements in the lst1
is in the proximity of the sum of the elements in the lst2
"""
if not lst:
if abs(sum(lst1)-sum(lst2)) in range(5):
return lst1, lst2
else:
return {Not sure what to put here} + proximity_lists(lst[1:])


As far as range() goes, it can take anything for an argument as long as it's the closest they can get in the proximity of each other. I picked 5 because based on the example output above the difference between them is 1.



I need to add that this has to be done without the help of any modules.It has be done using simple functions.










share|improve this question















I am asked to define a recursive function that takes in a list and then assigns the values of that list among two other lists in such a way that when you take the sum of each of those two lists you get two results that are in close proximity to each other.



Example:



If I run:



print(proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41]))


I get back two lists :



[31, 27, 21, 9, 8]          #sum = 96

[41, 24, 17, 8, 5] #sum = 95


This is how I did it, however I can't get my head around understanding how to return two lists in a recursive function. So far I was comfortable with conditions where I had to return one list.



This is my code so far:



def proximity_lists(lst, lst1 = , lst2 = ):
"""
parameters : lst of type list;
returns : returns two lists such that the sum of the elements in the lst1
is in the proximity of the sum of the elements in the lst2
"""
if not lst:
if abs(sum(lst1)-sum(lst2)) in range(5):
return lst1, lst2
else:
return {Not sure what to put here} + proximity_lists(lst[1:])


As far as range() goes, it can take anything for an argument as long as it's the closest they can get in the proximity of each other. I picked 5 because based on the example output above the difference between them is 1.



I need to add that this has to be done without the help of any modules.It has be done using simple functions.







python list recursion






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 21:33

























asked Nov 12 '18 at 21:19







user10158754



















  • List always even? Sublist always same size? Minimum sublist size? I mean [8] and [8] could be the best fit.
    – iGian
    Nov 12 '18 at 21:27










  • Such conditions weren't specified, so I guess anything goes as long as the sum of the two lists lie in the closest proximity of each other.
    – user10158754
    Nov 12 '18 at 21:29










  • Sorry, can you please ask a specific question. I understand your example and what has been asked of you but please just state a question which part of it you want help with.
    – trs
    Nov 12 '18 at 21:29










  • @trs I put out my code in order to get some insight on what to do in order to get that output
    – user10158754
    Nov 12 '18 at 21:30












  • Try start from here: stackoverflow.com/questions/27974126/…
    – iGian
    Nov 12 '18 at 21:32


















  • List always even? Sublist always same size? Minimum sublist size? I mean [8] and [8] could be the best fit.
    – iGian
    Nov 12 '18 at 21:27










  • Such conditions weren't specified, so I guess anything goes as long as the sum of the two lists lie in the closest proximity of each other.
    – user10158754
    Nov 12 '18 at 21:29










  • Sorry, can you please ask a specific question. I understand your example and what has been asked of you but please just state a question which part of it you want help with.
    – trs
    Nov 12 '18 at 21:29










  • @trs I put out my code in order to get some insight on what to do in order to get that output
    – user10158754
    Nov 12 '18 at 21:30












  • Try start from here: stackoverflow.com/questions/27974126/…
    – iGian
    Nov 12 '18 at 21:32
















List always even? Sublist always same size? Minimum sublist size? I mean [8] and [8] could be the best fit.
– iGian
Nov 12 '18 at 21:27




List always even? Sublist always same size? Minimum sublist size? I mean [8] and [8] could be the best fit.
– iGian
Nov 12 '18 at 21:27












Such conditions weren't specified, so I guess anything goes as long as the sum of the two lists lie in the closest proximity of each other.
– user10158754
Nov 12 '18 at 21:29




Such conditions weren't specified, so I guess anything goes as long as the sum of the two lists lie in the closest proximity of each other.
– user10158754
Nov 12 '18 at 21:29












Sorry, can you please ask a specific question. I understand your example and what has been asked of you but please just state a question which part of it you want help with.
– trs
Nov 12 '18 at 21:29




Sorry, can you please ask a specific question. I understand your example and what has been asked of you but please just state a question which part of it you want help with.
– trs
Nov 12 '18 at 21:29












@trs I put out my code in order to get some insight on what to do in order to get that output
– user10158754
Nov 12 '18 at 21:30






@trs I put out my code in order to get some insight on what to do in order to get that output
– user10158754
Nov 12 '18 at 21:30














Try start from here: stackoverflow.com/questions/27974126/…
– iGian
Nov 12 '18 at 21:32




Try start from here: stackoverflow.com/questions/27974126/…
– iGian
Nov 12 '18 at 21:32












3 Answers
3






active

oldest

votes


















1














This is potentially not the optimal solution in terms of performance (exponential complexity), but maybe it gets you started:



def proximity_lists(values):
def _recursion(values, list1, list2):
if len(values) == 0:
return list1, list2
head, tail = values[0], values[1:]
r1, r2 = _recursion(tail, list1 + [head], list2)
s1, s2 = _recursion(tail, list1, list2 + [head])
if abs(sum(r1) - sum(r2)) < abs(sum(s1) - sum(s2)):
return r1, r2
return s1, s2

return _recursion(values, , )

values = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
s1, s2 = proximity_lists(values)
print(sum(s1), sum(s2))
print(s1)
print(s2)

96 95
[24, 31, 41]
[5, 8, 8, 9, 17, 21, 27]


If it is not OK to have a wrapper function, just call _recursion(values, , ) directly.






share|improve this answer





























    0














    You can find all permutations of the original input for the first list, and filter the original to obtain the second. This answer assumes that "close proximity" means a difference less than or equal to 1 between the sums of the two lists:



    from collections import Counter

    def close_proximity(d, _dist = 1):
    def _valid(c, _original):
    return abs(sum(c) - sum([i for i in _original if i not in c])) <= _dist
    def combos(_d, current = ):
    if _valid(current, _d) and current:
    yield current
    else:
    for i in _d:
    _c1, _c2 = Counter(current+[i]), Counter(_d)
    if all(_c2[a] >= b for a, b in _c1.items()):
    yield from combos(_d, current+[i])
    return combos(d)

    start = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
    t = next(close_proximity(start))
    _c = [i for i in start if i not in t]
    print(t, _c, abs(sum(t) - sum(_c)))


    Output:



    [5, 8, 8, 9, 17, 21, 27] [24, 31, 41] 1





    share|improve this answer





























      0















      I can't get my head around understanding how to return two lists in a
      recursive function.




      Here's a simple solution that produces your original result but without extra arguments, inner functions, etc. It just keeps augmenting the lesser list from the next available value:



      def proximity_lists(array):
      if array:
      head, *tail = array

      a, b = proximity_lists(tail)

      ([a, b][sum(b) < sum(a)]).append(head)

      return [a, b]

      return [, ]


      USAGE



      >>> proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41])
      [[41, 24, 17, 8, 5], [31, 27, 21, 9, 8]]
      >>>





      share|improve this answer





















        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270285%2frecursive-function-that-takes-in-one-list-and-returns-two-lists%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown
























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        This is potentially not the optimal solution in terms of performance (exponential complexity), but maybe it gets you started:



        def proximity_lists(values):
        def _recursion(values, list1, list2):
        if len(values) == 0:
        return list1, list2
        head, tail = values[0], values[1:]
        r1, r2 = _recursion(tail, list1 + [head], list2)
        s1, s2 = _recursion(tail, list1, list2 + [head])
        if abs(sum(r1) - sum(r2)) < abs(sum(s1) - sum(s2)):
        return r1, r2
        return s1, s2

        return _recursion(values, , )

        values = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
        s1, s2 = proximity_lists(values)
        print(sum(s1), sum(s2))
        print(s1)
        print(s2)

        96 95
        [24, 31, 41]
        [5, 8, 8, 9, 17, 21, 27]


        If it is not OK to have a wrapper function, just call _recursion(values, , ) directly.






        share|improve this answer


























          1














          This is potentially not the optimal solution in terms of performance (exponential complexity), but maybe it gets you started:



          def proximity_lists(values):
          def _recursion(values, list1, list2):
          if len(values) == 0:
          return list1, list2
          head, tail = values[0], values[1:]
          r1, r2 = _recursion(tail, list1 + [head], list2)
          s1, s2 = _recursion(tail, list1, list2 + [head])
          if abs(sum(r1) - sum(r2)) < abs(sum(s1) - sum(s2)):
          return r1, r2
          return s1, s2

          return _recursion(values, , )

          values = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
          s1, s2 = proximity_lists(values)
          print(sum(s1), sum(s2))
          print(s1)
          print(s2)

          96 95
          [24, 31, 41]
          [5, 8, 8, 9, 17, 21, 27]


          If it is not OK to have a wrapper function, just call _recursion(values, , ) directly.






          share|improve this answer
























            1












            1








            1






            This is potentially not the optimal solution in terms of performance (exponential complexity), but maybe it gets you started:



            def proximity_lists(values):
            def _recursion(values, list1, list2):
            if len(values) == 0:
            return list1, list2
            head, tail = values[0], values[1:]
            r1, r2 = _recursion(tail, list1 + [head], list2)
            s1, s2 = _recursion(tail, list1, list2 + [head])
            if abs(sum(r1) - sum(r2)) < abs(sum(s1) - sum(s2)):
            return r1, r2
            return s1, s2

            return _recursion(values, , )

            values = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
            s1, s2 = proximity_lists(values)
            print(sum(s1), sum(s2))
            print(s1)
            print(s2)

            96 95
            [24, 31, 41]
            [5, 8, 8, 9, 17, 21, 27]


            If it is not OK to have a wrapper function, just call _recursion(values, , ) directly.






            share|improve this answer












            This is potentially not the optimal solution in terms of performance (exponential complexity), but maybe it gets you started:



            def proximity_lists(values):
            def _recursion(values, list1, list2):
            if len(values) == 0:
            return list1, list2
            head, tail = values[0], values[1:]
            r1, r2 = _recursion(tail, list1 + [head], list2)
            s1, s2 = _recursion(tail, list1, list2 + [head])
            if abs(sum(r1) - sum(r2)) < abs(sum(s1) - sum(s2)):
            return r1, r2
            return s1, s2

            return _recursion(values, , )

            values = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
            s1, s2 = proximity_lists(values)
            print(sum(s1), sum(s2))
            print(s1)
            print(s2)

            96 95
            [24, 31, 41]
            [5, 8, 8, 9, 17, 21, 27]


            If it is not OK to have a wrapper function, just call _recursion(values, , ) directly.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 12 '18 at 21:54









            Matthias Ossadnik

            57427




            57427

























                0














                You can find all permutations of the original input for the first list, and filter the original to obtain the second. This answer assumes that "close proximity" means a difference less than or equal to 1 between the sums of the two lists:



                from collections import Counter

                def close_proximity(d, _dist = 1):
                def _valid(c, _original):
                return abs(sum(c) - sum([i for i in _original if i not in c])) <= _dist
                def combos(_d, current = ):
                if _valid(current, _d) and current:
                yield current
                else:
                for i in _d:
                _c1, _c2 = Counter(current+[i]), Counter(_d)
                if all(_c2[a] >= b for a, b in _c1.items()):
                yield from combos(_d, current+[i])
                return combos(d)

                start = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
                t = next(close_proximity(start))
                _c = [i for i in start if i not in t]
                print(t, _c, abs(sum(t) - sum(_c)))


                Output:



                [5, 8, 8, 9, 17, 21, 27] [24, 31, 41] 1





                share|improve this answer


























                  0














                  You can find all permutations of the original input for the first list, and filter the original to obtain the second. This answer assumes that "close proximity" means a difference less than or equal to 1 between the sums of the two lists:



                  from collections import Counter

                  def close_proximity(d, _dist = 1):
                  def _valid(c, _original):
                  return abs(sum(c) - sum([i for i in _original if i not in c])) <= _dist
                  def combos(_d, current = ):
                  if _valid(current, _d) and current:
                  yield current
                  else:
                  for i in _d:
                  _c1, _c2 = Counter(current+[i]), Counter(_d)
                  if all(_c2[a] >= b for a, b in _c1.items()):
                  yield from combos(_d, current+[i])
                  return combos(d)

                  start = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
                  t = next(close_proximity(start))
                  _c = [i for i in start if i not in t]
                  print(t, _c, abs(sum(t) - sum(_c)))


                  Output:



                  [5, 8, 8, 9, 17, 21, 27] [24, 31, 41] 1





                  share|improve this answer
























                    0












                    0








                    0






                    You can find all permutations of the original input for the first list, and filter the original to obtain the second. This answer assumes that "close proximity" means a difference less than or equal to 1 between the sums of the two lists:



                    from collections import Counter

                    def close_proximity(d, _dist = 1):
                    def _valid(c, _original):
                    return abs(sum(c) - sum([i for i in _original if i not in c])) <= _dist
                    def combos(_d, current = ):
                    if _valid(current, _d) and current:
                    yield current
                    else:
                    for i in _d:
                    _c1, _c2 = Counter(current+[i]), Counter(_d)
                    if all(_c2[a] >= b for a, b in _c1.items()):
                    yield from combos(_d, current+[i])
                    return combos(d)

                    start = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
                    t = next(close_proximity(start))
                    _c = [i for i in start if i not in t]
                    print(t, _c, abs(sum(t) - sum(_c)))


                    Output:



                    [5, 8, 8, 9, 17, 21, 27] [24, 31, 41] 1





                    share|improve this answer












                    You can find all permutations of the original input for the first list, and filter the original to obtain the second. This answer assumes that "close proximity" means a difference less than or equal to 1 between the sums of the two lists:



                    from collections import Counter

                    def close_proximity(d, _dist = 1):
                    def _valid(c, _original):
                    return abs(sum(c) - sum([i for i in _original if i not in c])) <= _dist
                    def combos(_d, current = ):
                    if _valid(current, _d) and current:
                    yield current
                    else:
                    for i in _d:
                    _c1, _c2 = Counter(current+[i]), Counter(_d)
                    if all(_c2[a] >= b for a, b in _c1.items()):
                    yield from combos(_d, current+[i])
                    return combos(d)

                    start = [5, 8, 8, 9, 17, 21, 24, 27, 31, 41]
                    t = next(close_proximity(start))
                    _c = [i for i in start if i not in t]
                    print(t, _c, abs(sum(t) - sum(_c)))


                    Output:



                    [5, 8, 8, 9, 17, 21, 27] [24, 31, 41] 1






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 12 '18 at 21:59









                    Ajax1234

                    40.3k42653




                    40.3k42653























                        0















                        I can't get my head around understanding how to return two lists in a
                        recursive function.




                        Here's a simple solution that produces your original result but without extra arguments, inner functions, etc. It just keeps augmenting the lesser list from the next available value:



                        def proximity_lists(array):
                        if array:
                        head, *tail = array

                        a, b = proximity_lists(tail)

                        ([a, b][sum(b) < sum(a)]).append(head)

                        return [a, b]

                        return [, ]


                        USAGE



                        >>> proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41])
                        [[41, 24, 17, 8, 5], [31, 27, 21, 9, 8]]
                        >>>





                        share|improve this answer


























                          0















                          I can't get my head around understanding how to return two lists in a
                          recursive function.




                          Here's a simple solution that produces your original result but without extra arguments, inner functions, etc. It just keeps augmenting the lesser list from the next available value:



                          def proximity_lists(array):
                          if array:
                          head, *tail = array

                          a, b = proximity_lists(tail)

                          ([a, b][sum(b) < sum(a)]).append(head)

                          return [a, b]

                          return [, ]


                          USAGE



                          >>> proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41])
                          [[41, 24, 17, 8, 5], [31, 27, 21, 9, 8]]
                          >>>





                          share|improve this answer
























                            0












                            0








                            0







                            I can't get my head around understanding how to return two lists in a
                            recursive function.




                            Here's a simple solution that produces your original result but without extra arguments, inner functions, etc. It just keeps augmenting the lesser list from the next available value:



                            def proximity_lists(array):
                            if array:
                            head, *tail = array

                            a, b = proximity_lists(tail)

                            ([a, b][sum(b) < sum(a)]).append(head)

                            return [a, b]

                            return [, ]


                            USAGE



                            >>> proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41])
                            [[41, 24, 17, 8, 5], [31, 27, 21, 9, 8]]
                            >>>





                            share|improve this answer













                            I can't get my head around understanding how to return two lists in a
                            recursive function.




                            Here's a simple solution that produces your original result but without extra arguments, inner functions, etc. It just keeps augmenting the lesser list from the next available value:



                            def proximity_lists(array):
                            if array:
                            head, *tail = array

                            a, b = proximity_lists(tail)

                            ([a, b][sum(b) < sum(a)]).append(head)

                            return [a, b]

                            return [, ]


                            USAGE



                            >>> proximity_lists([5, 8, 8, 9, 17, 21, 24, 27, 31, 41])
                            [[41, 24, 17, 8, 5], [31, 27, 21, 9, 8]]
                            >>>






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 13 '18 at 1:09









                            cdlane

                            17.1k21043




                            17.1k21043






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270285%2frecursive-function-that-takes-in-one-list-and-returns-two-lists%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Xamarin.iOS Cant Deploy on Iphone

                                Glorious Revolution

                                Dulmage-Mendelsohn matrix decomposition in Python