I get a TypeError and I don't understand why. The error is at `c = t[i][0]` (according to the debugger). I have 3 char groups(lists): `g1`, `g2` and `g3` and I'm trying to change the char's index by substracting the key's `k1`, `k2` or `k3` from the index. What I'm using now for testing: 

```
text = 'abcd'

l_text = [('a', 0), ('b', 1), ('c', 2), ('d', 3)]

k1, k2, k3 = 2, 3, 1

```

And this is the code:

```
def rotate_left(text, l_text, k1, k2, k3):
    i = 0
    newstr = [None]*len(text)
    for t in l_text: # t = tuple
        c = t[i][0] 
        if c in g1: # c = char
            l = int(l_text[i][1]) # l = index of the char in the list
            if l - k1 < 0:
                newstr[l%len(text)-k1] = l_text[i][0]
            else:
                newstr[l-k1] = l_text[i][0]
        elif c in g2:
            l = l_text[i][1] # l = index of the char in the list
            if l - k1 < 0:
                newstr[l%len(text)-k2] = l_text[i][0]
            else:
                newstr[l-k2] = l_text[i][0]
        else:
            l = l_text[i][1] # l = index of the char in the list
            if l - k1 < 0:
                newstr[l%len(text)-k3] = l_text[i][0]
            else:
                newstr[l-k3] = l_text[i][0]
        i += 1
    return newstr

```

Can someone explain me why do I get this error and how do I fix it? It's not like I'm using an `int` type there. The debugger shows it's a str type and it breaks after the 2nd iteration.

PS google didn't help
PPS I know there is too much repetition in the code. I did it to see in the debugger what's happening.

UPDATE:

```
Traceback (most recent call last):
  File "/hometriplerotatie.py", line 56, in <module>
    print(codeer('abcd', 2, 3, 1))
  File "/home/triplerotatie.py", line 47, in codeer
    text = rotate_left(text, l_text, k1, k2, k3)
  File "/home/triplerotatie.py", line 9, in rotate_left
    c = t[i][0] 
TypeError: 'int' object is not subscriptable

```