Aug-25-2018, 05:08 AM
Hi
I'm working on something and it has a nested while loop. It seems like only the inner loop is running and only once;
Code:
I'm working on something and it has a nested while loop. It seems like only the inner loop is running and only once;
Code:
def answer(x, y):
idbadge = [[0 for i in range(x)] for i in range(y)]
row = 0
col = 0
a = 1
#################Detemine number of cells###############
count = 0
counter = 0
i=0
a=0
while (a < x):
i = i + 1
a = a + i
count = i
counter = i
print("Count is " + str(count));
print("Counter is " + str(counter))
row = 0
col = 0
a = 1
#n = 0
##############Build Matrix###############
row = 0
col = 0
a = 1
t = 2
print("Count: " + str(count))
while col < count:
while row < count:
print("Row:" + str(row))
print("Col:" + str(col))
print("ID BADGE" + str(a))
idbadge[row][col] = a
row = row + 1
a = a + row
col = col + 1
#t = t + 1
#a = t
###############Print Out###############
#print top row (row 0)
#print second top row
#continue printing until row is equal to 4
answer(10,10)
