[Solved] How do you put words into a 3×3 grid using python [duplicate]


import random
words = ["a", "b", "c", "d", "e", "f", "g", "h", "i"]

random.shuffle(words) 

grouped = [words[i:i+3] for i in range(0, len(words), 3)]
for l in grouped:
    print "".join("{:<10}".format(x) for x in l)

Output:

e         h         b         
i         c         g         
a         d         f     

Remove the random.shuffle(words) line if you need the original a,b,c,d,etc order.

solved How do you put words into a 3×3 grid using python [duplicate]