Python关于笛卡尔积在input创建空值列表,然后求积,怎么写?

from itertools import product
res = list(product(['a','b'],['c'],['d','e','g']))
print(res)

是不是指如下这样子:

>>> list1 = list(input())
ab
>>> list2 = list(input())
c
>>> list3 = list(input())
deg
>>> from itertools import product
>>> res = list(product(list1,list2,list3))
>>> for r in res:
    print(''.join(r),end=' ')

    
acd ace acg bcd bce bcg 
>>> 

如不是,请沟通