I expanded and added as a new question.
I have a list:
li = [2, 3, 1, 4, 2, 2, 2, 3, 1, 3, 2]
Then I find out what value is most often found, what value I save in a variable i2:
f = {}
for item in li:
f[item] = f.get(item, 0) + 1
for i in f:
if f[i]==int(max(f.values())):
i2 = i
Later, all values that are repeated increase by 10, but in addition to the maximum values. This is the code I'm using:
for i in range(len(li)):
for x in range(i + 1, len(li)):
if li[i] == li[x] and li[i] != i2:
li[x] = li[x] + 10
After this operation, I get:
li = [2, 3, 1, 4, 2, 2, 2, 13, 11, 23, 2]
, 2, . , 3 , 3, 3 + 10, 3 + 20. ( 2).
( ), 10 :
li = [2, 3, 1, 4, 2, 12, 22, 13, 11, 23, 2]
?
, li[i] == li[i+1], , , ?