Adding Values From Tuples of Same Length

后端 未结 6 977
隐瞒了意图╮
隐瞒了意图╮ 2020-12-06 05:07

In a graphical program I\'m writing using pygame I use a tuple representing a coordinate like this: (50, 50).

Sometimes, I call a function which returns another tupl

6条回答
  •  借酒劲吻你
    2020-12-06 05:31

    As John Y mentions, this is pretty easy using numpy.

    import numpy as np
    
    x1 = (0,3)
    x2 = (4,2)
    tuple(np.add(x1,x2))
    

提交回复
热议问题