| 1 | initial version |
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),[],[])
| 2 | No.2 Revision |
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),[],[])
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.