import string
letters=string.ascii_lowercase
letters
'abcdefghijklmnopqrstuvwxyz'
we are looking to convert letters
into a list of length 26^2, featuring all unordered pairings of letters ['aa', 'ab', 'ac', ..., 'az', 'ba', 'bb', 'bc', ..., 'zz']
. I am looking to avoid code that looks like this:
letter_list = []
for letter1 in letters:
for letter2 in letters:
letter_list.append(f'{letter1}{letter2}')
Is there a 1 liner with nested list comprehension?