I have a list like below, 

```
list_ = [('a', 5), ('a', 6), ('a', 8), ('a', 2), ('a', 5), ('a', 9), ('a', 10),
             ('b', 3), ('b', 7), ('b', 6), ('b', 2), ('b', 6), ('b', 5), ('b', 10)]

```

I want to do the following operation.
If the values in tuple increase i must keep track of increment, if it decrease i must keep track of decrement and finally i need the sum of both.

```
# for key 'a' for example
# increment      decrement
#       1             6
#       2
#       3
#       4
#       1
# Hence total increment is 11 and decrement is 6
# so I need the result like this. ('a', (11, 6))

```

I did like this to get the increment for example, but not working.

```
from collections import defaultdict

d = defaultdict(list)
for k, v in list_:
    d[k].append(v)

counter1 = 0

for key, value in d.items():
  for i in range(len(value)):
    try:
      if value[i] < value[i+1]:
        s = value[i+1] - value[i]
        counter1 +=s
    except:
      pass

print(counter1)

```