printing the array triplets in python