I am a novice programmer in python and was wondering if I can get a little help. The code I am about to show below prints out a simple array based on the users input for # of rows and # of columns. The array itself is filled with underscores ('_'):
new_list = []
undersc = '_'
for i in range(1, rows + 1):
new = []
for j in range(1, columns + 1):
new.append(undersc)
new_list.append(new)

for c in range(len(new_list[0])):
print()
for r in range(len(new_list)):
for c in range(len(new_list[0])):
array = print((new_list[r][c]), end=" ")
print()
return array
The console outputs the following:
_ _ _ _ _

_ _ _ _ _

_ _ _ _ _
The output that I need to get now is this:
Z _ _ _ _

Z Z _ _ _

Z Z Z _ _
Basically I see that each column is filling up sequential as you move down a row however, I am lost as to how I can get my code above to do this. Any help would be greatly appreciated!


View Solution