For some reason after the second loop in my array the code is skipping a character for some reason.
I think here is the problem:
    for word in range(int(len(ShortArray))):
        localString = LongArray[word]
        #print(word)
        if localString[:2] == ShortArray[word]:
            print(LongArray[word])
            print(word)
Here is the full code:
kleuren = ["Rood","Geel","Groen","Blauw","Wit","Paars","Oranje","Zwart"]
KleurenShort = []
def splitArray(string):
    for lenght in range(int(len(string) / 2)):
        KleurenShort.append(string[:2])
        print(KleurenShort)
        string = string.strip(string[:2])
    return KleurenShort
def tekst_naar_kleur(string):
    return 0
def matchFirst2Letters(ShortArray,LongArray):
    for word in range(int(len(ShortArray))):
        localString = LongArray[word]
        #print(word)
        if localString[:2] == ShortArray[word]:
            print(LongArray[word])
            print(word)
matchFirst2Letters(splitArray("RoGeGrBl"),kleuren)
The outcome is:
['Ro']
['Ro', 'Ge']
['Ro', 'Ge', 'rB']
['Ro', 'Ge', 'rB', 'l']
when it should be:
['Ro']
['Ro', 'Ge']
['Ro', 'Ge', 'Gr']
['Ro', 'Ge', 'Gr', 'Bl']
 
    