how to compare two strings in python using for loop