0

I want to print numbers in appropriate way in Python:

0  6 12
1  7 13
2  8 14
3  9 15
4 10 16

I want to do it in function e.g. num_print(x, y, step) where:

x - number of columns
y - number of rows
step - diff between numbers in row

I did something like this, but this is not what I want, because when I call function the value of columns is not appropriate (13 should be 3):

def num_print(vert, hori, step):
    for y in range(vert):
        for x in range(y, y + hori, step):
            print(x, end = ' ')
        print('')
num_print(5, 13, 6)

Can someone show me maybe better way how to do this? and indentation of numbers like in example is welcome ;)

0 Answers0