The following is the code I wrote:
def comb(self, rows, cols):
return [s+t for s in a for t in b]
If the values of rows and cols are
rows = ['abc','efg']
cols = ['123','456']
Expected output: ['abc123','abc456,'efg123','efg456']
Program output: ['a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'c1', 'c2', 'c3']
I am new to Python programming. Could you help me understand what is happening? I already fixed the output but I would like to understand why this happened.