# 1. Original matrixmatrix = [ [1, 'a', 'the letter a'] , [2, 'b', 'the letter b'] ] # 2. Inserting the same fixed valuematrix = [ x + ['new fixed value'] for x in matrix ] # 3. Insert a consecutive numeric valuematrix = [ pair[1] + [pair[0]] for pair in enumerate(matrix) ]
No comments:
Post a Comment