我这文字组合编号的代码,有什么问题么?

text = '''
主角,反派,对手,盟友
男,女
有,无
钱,智,信,情
'''
a, b, c = map(lambda x: x.split(','), text[1:-1].split('\n'))
k = 1
temp = []
for person in c:
    for speak in b:
        for day in a:
            s = f"{day}{speak}{person}"
            print(f"({k}) {s}")
            temp.append(s)
            k += 1
temp.sort(key=lambda x: x[:2])
print() 
for k,i in enumerate(temp):
    print(f"{k+1}. {i}")


你的a b c赋值的时候有问题,修改后的代码和运行结果如下

text = '''
主角,反派,对手,盟友
男,女
有,无
钱,智,信,情
'''
map(lambda x: x.split(','), text[1:-1].split('\n'))
tmp = list(map(lambda x: x.split(','), text[1:-1].split('\n')))
a,b,c = tmp[0], tmp[1], tmp[2]
k = 1
temp = []
for person in c:
    for speak in b:
        for day in a:
            s = f"{day}{speak}{person}"
            print(f"({k}) {s}")
            temp.append(s)
            k += 1
temp.sort(key=lambda x: x[:2])
print() 
for k,i in enumerate(temp):
    print(f"{k+1}. {i}")

img