I have a list of strings. I need to list them in rows and columns. Each row should not have more than "cols" number of values. Each of the values in a given row should be "step" away from the previous value. The values should appear only once in the output. Here is what I have. Any better way to write this code?
cols = 4 step = 10 vlist = ["Value" + str(i+1) for i in range(100)] vlen = len(vlist) start = 0 while start < vlen and start < step: num = 0 for idx in range(start, vlen, step): if num < cols: print(vlist[idx], end=", ") num += 1 print("\n") start += 1