Re: [Tutor] Help with List

2015-07-26 Thread Steven D'Aprano
On Sun, Jul 26, 2015 at 10:04:19AM +0530, Anurag Vyas wrote: > Hello Team, > I am noob to programming. I am trying to remove a item from a list. The > item that I am trying to remove has multiple entries in the list. I am not > able to remove all the entries. > Please Help. The code is in the attac

Re: [Tutor] help with list permutations

2008-01-04 Thread Kent Johnson
Chris Fuller wrote: > This is a good case for recursion. My solution is in two steps. > Here is the code: > > def recursion_is_your_friend(l): >if len(l) == 1: > return l >else: > return [ (i, recursion_is_your_friend(l[1:])) for i in l[0] ] > > l = recursion_is_your_friend([[

Re: [Tutor] help with list permutations

2008-01-03 Thread Chris Fuller
This is a good case for recursion. My solution is in two steps. A straightforward application of recursion (I was casting about semi-randomly) yields a attractive tree structure: root a b c d e c de f f f f ff g h