def make_square(inp):
    square = (
        ' {0} |{1}\t|{2}\n_____________\n  {3} | {4}\t|{5}\n_____________\n {6}  |{7}\t|{8}'
        )
inp += -1
for x in range(9):
    if x != inp:
        square = square.replace('{{{0}}}'.format(x), ' ')
square = square.replace('{{{0}}}'.format(inp), '{0}')
square = square.format('X')
print(square)
make_square(2)
Combine same function with different parameters - Python