The logic that you used is not correct as iterates whole tuples and thus gives the first tuple as the output when you run the command. As given by Avinash you will have to iterate over each individual element in the tuples and match them side by side. I will recommend the izip function in itertools if you are using python2 else in python3 simple zip function would suffice.