You are using zip() incorrectly; use it with two lists:
zipped = zip(country_name, country_code)
You apply it for each country name and country code separately:
>>> zip('South Africa', 'ZA') [('S', 'Z'), ('o', 'A')]
zip() combines two input sequences by combining each element; in lines, individual characters are elements of a sequence. Since there are only two characters in country codes, you get lists of two items, each of which consists of paired pairs.
Once you combine both lists into a new one, you can certainly sort this list either on the first or on the second element:
>>> zip(country_name, country_code) [('South Africa', 'ZA'), ('India', 'IN'), ('United States', 'US')] >>> sorted(zip(country_name, country_code)) [('India', 'IN'), ('South Africa', 'ZA'), ('United States', 'US')] >>> from operator import itemgetter >>> sorted(zip(country_name, country_code), key=itemgetter(1)) [('India', 'IN'), ('United States', 'US'), ('South Africa', 'ZA')]