0

This is an example of the code

    elif longitude > longitudel and latitude < latitudel:
            thor = 1,-1 + thor

I want it to change if say thor is = 1,1 I want it to become 2,0 I have been messing around with it for a while but I cant seem to find a way to get this to work and keep it as a tuple. Is there a way to keep it as a tuple or do I have to set seperate integers to get this to work ?

Xeshm
  • 1
  • 1

1 Answers1

0

You can do it like this:

thor = tuple(sum(x) for x in zip(thor, (1,-1)))

A shorter way would be:

thor = tuple(map(sum, zip(thor, (1,-1))))

Taken from here.

Ashish Acharya
  • 3,349
  • 1
  • 16
  • 25