Q: How to get identical translation source with different result I'm trying to get the identical translation source with different result in my dictionary, 
I have two lists, 
source = ['text1', 'text2', 'text3', 'text2', ...etc.]
target = ['trans1', 'trans2', 'trans3', 'trans4', ...etc.]


here source 'text2' duplicated many times two or more, but in target list every one or some of them has different value, 
update
what I want to do:
when i pass those two arrays to that function it returns to me something like
[{'source_list_index': ['target_list_index', etc.]}: {'', []}, ]


for my example the output should be something like:
[{1: [1, 3]}]

or any other readable output
where source value has many different values in target array
my running code 
import collections

source = [1, 1, 2, 3, 4, 4, 4, 5, 6]
target = [1, 2, 2, 3, 1, 2, 3, 5, 6]

duplicate_1 = [item for item, count in collections.Counter(source).items() if count > 1]
duplicate_2 = [item for item, count in collections.Counter(target).items() if count > 1]


def getIndexPositions(listOfElements, element):
    ''' Returns the indexes of all occurrences of give element in
    the list- listOfElements '''
    indexPosList = []
    indexPos = 0
    while True:
        try:
            # Search for item in list from indexPos to the end of list
            indexPos = listOfElements.index(element, indexPos)
            # Add the index position in list
            indexPosList.append(indexPos)
            indexPos += 1
        except ValueError as e:
            break

    return indexPosList

indexPosList=[]

for i in duplicate_1:
    indexPosList = getIndexPositions(source, i)

    print(indexPosList)

    for i in indexPosList:
        print(source[i])
        for x in indexPosList:

            if target[i] == target[x]:
                print('same target')
            else:
                print(source[i], 'different target :   first value is : ', target[i], '  ##### and ######  second value is: ', target[x])


but there is many nested loops and I believe there is a way better than that
any one have an idea ?
many thanks

A: I believe this will do something similar to what you want:
def get_translation(source, target):
    output = {}
    for name, trans in zip(source, target):
        if name in output:
            output[name].append(trans)
        else:
            output[name] = [trans]
    return output

This does not take the indexes and create a dictionary of integers, instead it copies the strings that are contained in source and target. 
It goes through the two lists at the same time. If the name is not in the dictionary output then it will be added to the dictionary as a list containing trans. If the name is already in the dictionary then trans is added to the end of that list.
So, the input:
source = ['text1', 'text2', 'text3', 'text2']
target = ['trans1', 'trans2', 'trans3', 'trans4']

Will produce the output:
{'text1':['trans1'], 'text2':['trans2', 'trans4'], 'text3':['trans3']}

Input:
source = [1, 1, 2, 3, 4, 4, 4, 5, 6]
target = [1, 2, 2, 3, 1, 2, 3, 5, 6]

Output:
{1: [1, 2], 2: [2], 3: [3], 4: [1, 2, 3], 5: [5], 6: [6]}


A: step 1: find repeated entries.
step 2: get indices for each repeated entry
step 3 check if equal or not, example here text3 is used twice but has the same translation
step 4: append list of dictionary? (I don't get that format)
source = ['text1', 'text2', 'text3', 'text2', 'text3', 'text1']
target = ['trans1', 'trans2', 'trans3', 'trans4', 'trans3', 'trans6']

def get_repeated_translations(source, target):
    double_translation_entries = []
    reapeated_entries = list(set([x for i, x in enumerate(source) if source.count(x)>1 and source.index(x) < i]))
    for repeated_entry in reapeated_entries:
        indices_of_repeated_entry = [i for i, x in enumerate(source) if x == repeated_entry]
        entry_translation = target[indices_of_repeated_entry[0]]
        for translated_index in indices_of_repeated_entry:
            if target[translated_index] != entry_translation:
                double_translation_entries.append({source.index(repeated_entry) : indices_of_repeated_entry})
                break

    return double_translation_entries

print(get_repeated_translations(source,target))

result:
[{1: [1, 3]}, {0: [0, 5]}]
[Finished in 0.075s]

