我有以下元组列表:
>>> list_of_tuples = [(0, 0), (0, -1), (1, -1), (1, -2), (1, -3), (1, -4), (0, -4), (0, -3), (-1, -3), (-2, -3), (-2, -2), (-2, -1), (-1, -1), (-1, -2), (0, -2)]
我想要以下内容:
>>> addvalues(list_of_tuples)
[(2, 0), (2, -1), (3, -1), (3, -2), (3, -3), (3, -4), (2, -4), (2, -3), (1, -3), (0, -3), (0, -2), (0, -1), (1, -1), (1, -2), (2, -2)]
#original
>>> list_of_tuples
[(0, 0), (0, -1), (1, -1), (1, -2), (1, -3), (1, -4), (0, -4), (0, -3), (-1, -3), (-2, -3), (-2, -2), (-2, -1), (-1, -1), (-1, -2), (0, -2)]
对于list_of_tuples 中的元组,元组[0] 中的最小值是-2,我想为每个元组[0] 添加一个值,直到最小值为0,你是怎么做到的?(通常最低值不需要是-2)