I have with me two values like p and q where p is an integer and q is a string.
I need a data structure to store such values as
You can use a 2d array. I am assuming the p and q are list with the same length. have a look to the code below.
p = [1,5,7,3,5,7,45,23] q = ['one', 'five', 'seven', 'three', 'five', 'seven', 'forty five', 'twenty three'] array = [[ 0 for x in range(2)] for y in range(len(p))] for index, val in enumerate(p): array[index] = val array[index] = q[index] print "first five to display:" for i in range(5): print str(array[i]) + " - " + array[i] print print "sorted array by the integer" for val in sorted(array): print str(val) + " - " + val