Like these python below
[m + n for m in 'ABC' for n in 'XYZ']
>>> ['AX', 'AY', 'AZ', 'BX', 'BY', 'BZ', 'CX', 'CY', 'CZ']
How to archive it in ruby in one line?
thanks a lot.
Another one using Array#product and Array#join:
'ABC'.chars.product('XYZ'.chars).map(&:join)
#=> ["AX", "AY", "AZ", "BX", "BY", "BZ", "CX", "CY", "CZ"]