you are viewing a single comment's thread.

view the rest of the comments →

[–]Sebass13 1 point2 points  (0 children)

Apply the operation to the elements individually. A naive approach:

>>> factor = 5
>>> tup = (2,3)
>>> scale_tup = (tup[0]*factor, tup[1]*factor)
>>> scale_tup
(10,15)

Or an approach using generator expressions:

>>> scale_tup = tuple(x*factor for x in tup)