# ArcPY Python List

Question asked by cesar_garridoleccari@redlands.edu_univredlands on May 24, 2018
Latest reply on May 25, 2018 by tkowal
I have a problem codding. I wonder if you could give me a hand with this:
I have this list of tuples:

[['060710080013011', 9, 155], ['060710080013011', 9, 156], ['060710080013011', 9, 157], ['060710080013011', 9, 164], ['060710080013011', 9, 165], ['060710080013011', 9, 166], ['060710080013011', 9, 170], ['060710080013011', 9, 171], ['060710080013011', 9, 172], ['060710080013033', 8, 86], ['060710080013033', 8, 90], ['060710080013033', 8, 91], ['060710080013033', 8, 97], ['060710080013033', 8, 99], ['060710080013033', 8, 100], ['060710080013033', 8, 103], ['060710080013033', 8, 105], ['060710080021000', 10, 87], ['060710080021000', 10, 88], ['060710080021000', 10, 89], ['060710080021000', 10, 92], ['060710080021000', 10, 93], ['060710080021000', 10, 94], ['060710080021000', 10, 95], ['060710080021000', 10, 96], ['060710080021000', 10, 98], ['060710080021000', 10, 102]]

So the first value is an ID y the second value is how many times this id is appearing on the list. The problem is the following.

When the second value is greater than 7, I need to change the values in every second item in each tuple here the example:

[['060710080013011', 7, 155], ['060710080013011', 7, 156], ['060710080013011', 7, 157], ['060710080013011', 7, 164], ['060710080013011', 7, 165], ['060710080013011', 7, 166], ['060710080013011', 7, 170], ['060710080013011_2', 2, 171], ['060710080013011_2', 2, 172]]

As you can see, instead of having 9 in all the values, I have 7 and 2, and I have to change the id of the left 2 adding a '_2' at the end. Basically, the rule is, id the value is greater than 7, then divide the value by 7. and put the residual in the rest of values. It could be the case that a value has 15 appearances. In that case, we will have 2 groups of 7 and one of 1

Please, I have been trying to solve this a lot of time, I can not find a solution.