I'm trying to generate unique permutations of length two from a string but I'm getting repeated values. What am I doing wrong? Here's the code:
a = 'abba'
from itertools import permutations
x = []
x = [y for y in list(permutations(a,2)) if y not in x]
'''
output was this:
[('a', 'b'), ('a', 'b'), ('a', 'a'), ('b', 'a'), ('b', 'b'), ('b', 'a'), ('b', 'a'), ('b', 'b'),('b', 'a'), ('a', 'a'), ('a', 'b'), ('a', 'b')]
'''