import sys t = "PYTHON" for i in range(len(t)): for j in range(len(t)): p = i+j if (p>=len(t)): p = len(t)-p-2 sys.stdout.write(t[p]+" ") print