# Revision history [back]

First, your variable n has to be a number, not a string: you should replace '3' by 3 in your second line:

def matrix(n=input_box(3, label="Number")):


Then, you should use this variable somewhere in your code, if you want its modification to take effect. If I assume that n aims to be the number of blocks, this parameter appears in the definition of the blocks:

towers = (range(4,0,-1),[],[])


Here, range(4,0,-1) is the list [4, 3, 2, 1] corresponding to the lengths of the blocks of the first column. What you have is to replace this number by your variable n:

towers = (range(n,0,-1),[],[])


First, your variable n has to be a number, not a string: you should replace '3' by 3 in your second line:

def matrix(n=input_box(3, label="Number")):


Then, you should use this variable somewhere in your code, if you want its modification to take effect. If I assume that n aims to be the number of blocks, this parameter appears in the definition of the blocks:towers (at the end of the code):

towers = (range(4,0,-1),[],[])


Here, range(4,0,-1) is the list [4, 3, 2, 1] corresponding to the lengths of the blocks of the first column. tower. What you have should do is to replace this number by your variable n:

towers = (range(n,0,-1),[],[])