a = 'qwerty'
b = '^%$#'
c = [(x,y) for x in a for y in b]
c
[('q', '^'), ('q', '%'), ('q', ''), ('q', '$'), ('q', '#'), ('w',
'^'), ('w', '%'), ('w', ''), ('w', '$'), ('w', '#'), ('e', '^'),
('e', '%'), ('e', ''), ('e', '$'), ('e', '#'), ('r', '^'), ('r',
'%'), ('r', ''), ('r', '$'), ('r',
On Dec 19, 12:48 pm, Chris Rebert c...@rebertia.com wrote:
On Sat, Dec 19, 2009 at 2:54 AM, mattia ger...@gmail.com wrote:
Hi all, I need to create the permutation of two strings but without
repeat the values, e.g. 'ab' for me is equal to 'ba'. Here is my
solution, but maybe the python
Il Sun, 20 Dec 2009 03:49:35 -0800, Chris Rebert ha scritto:
On Dec 19, 12:48 pm, Chris Rebert c...@rebertia.com wrote:
On Sat, Dec 19, 2009 at 2:54 AM, mattia ger...@gmail.com wrote:
Hi all, I need to create the permutation of two strings but without
repeat the values, e.g. 'ab' for me is
Hi all, I need to create the permutation of two strings but without
repeat the values, e.g. 'ab' for me is equal to 'ba'. Here is my
solution, but maybe the python library provides something better:
def mcd(a, b):
... if b == 0:
... return a
... else:
... return mcd(b,
On Sat, Dec 19, 2009 at 2:54 AM, mattia ger...@gmail.com wrote:
Hi all, I need to create the permutation of two strings but without
repeat the values, e.g. 'ab' for me is equal to 'ba'. Here is my
solution, but maybe the python library provides something better:
def mcd(a, b):
... if b
On 12/19/2009 11:48 PM, Chris Rebert wrote:
Surprised you didn't think of the seemingly obvious approach:
def permute_chars(one, two):
for left in set(one):
for right in set(two):
yield (left, right)
list(permute_chars('abc', 'wt'))
[('a', 'w'), ('a', 't'), ('b',
Il Sat, 19 Dec 2009 10:54:58 +, mattia ha scritto:
Hi all, I need to create the permutation of two strings but without
repeat the values, e.g. 'ab' for me is equal to 'ba'. Here is my
solution, but maybe the python library provides something better:
def mcd(a, b):
... if b == 0: