+ 1

What will be code if we want to print only those permuted strings starting with 'A' ???

from itertools import product, permutations letters = ("A", "B") print(list(permutations(letters)))

7th Mar 2020, 8:22 PM
Ana
2 Answers
+ 4
You can try this: from itertools import product, permutations letters = ("A", "B","C") print(list(permutations(letters))) # for information only print([i for i in list(permutations(letters)) if i[0].startswith('A')])
7th Mar 2020, 9:39 PM
Lothar
Lothar - avatar
+ 3
Both of u..Thnx a lot😊
7th Mar 2020, 9:41 PM
Ana