Q:

While loop not executing till end of count

Code:
import os, sys, time

sum = 0

class_grades1 = [ ["Calculation", "ALLAHABAD", "DEORIA"],["Cell count", 10, 20],["Total VoLte Traffic", 100, 200],["Total VoLte Traffic", 1000, 2000] ]

class_grades2 = [ ["Calculation", "ALLAHABAD", "DEORIA"],["Cell count", 11, 21],["Total VoLte Traffic", 101, 201],["Total VoLte Traffic", 1001, 2001] ]

class_grades_diff = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]

r1 = len(class_grades1)
r2 = len(class_grades2)

c1 = len(class_grades1[1])
c2 = len(class_grades2[1])

print ("Column are: ",len(class_grades1[1]), len(class_grades2[1]))
print ("Column are: ",c1, c2)

print ("Row are: ",len(class_grades1), len(class_grades2))
print ("Row are: ",r1,r2)

if len(class_grades1) == len(class_grades2) and len(class_grades1[1]) == len(class_grades2[1]):
    print ("\n\nLength is same")
    print ("\n\nclass_grades1\tclass_grades2\tDifference")

    r = 1
    c = 1

    while r < len(class_grades1):
        while c < c1:
            #print (class_grades_diff[k][0])
            class_grades_diff[r][c] = class_grades2[r][c] - class_grades1[r][c]
            print (class_grades2[r][c],"\t\t\t\t",class_grades1[r][c],"\t\t\t\t",class_grades_diff[r][c])
            print("Values of r and c", r, c)
            print("\n")
            #class_grades_diff[k][1] = class_grades2[k][1] - class_grades1[k][1]
            #print(class_grades2[k][1], "\t\t\t\t", class_grades1[k][1], "\t\t\t\t", class_grades_diff[k][1])
            c = c + 1
        r = r + 1

else:
    print("Length is NOT same")

OUTPUT:
**Output:**
Column are:  3 3
Column are:  3 3
Row are:  4 4
Row are:  4 4

Length is same

class_grades1   class_grades2   Difference
11               10                  1
Values of r and c 1 1

21               20                  1
Values of r and c 1 2

A:

If you are wanting to repeat the nested while loop each time when r increases.
while c < c1:
            #print (class_grades_diff[k][0])
            class_grades_diff[r][c] = class_grades2[r][c] - class_grades1[r][c]
            print (class_grades2[r][c],"\t\t\t\t",class_grades1[r][c],"\t\t\t\t",class_grades_diff[r][c])
            print("Values of r and c", r, c)
            print("\n")
            #class_grades_diff[k][1] = class_grades2[k][1] - class_grades1[k][1]
            #print(class_grades2[k][1], "\t\t\t\t", class_grades1[k][1], "\t\t\t\t", class_grades_diff[k][1])
            c = c + 1

you should reset c every time the nested loop starts again. It should look like
while r < len(class_grades1):
        c= 1  # resetting c.
        while c < c1:
            #print (class_grades_diff[k][0])
            class_grades_diff[r][c] = class_grades2[r][c] - class_grades1[r][c]
            print (class_grades2[r][c],"\t\t\t\t",class_grades1[r][c],"\t\t\t\t",class_grades_diff[r][c])
            print("Values of r and c", r, c)
            print("\n")
            #class_grades_diff[k][1] = class_grades2[k][1] - class_grades1[k][1]
            #print(class_grades2[k][1], "\t\t\t\t", class_grades1[k][1], "\t\t\t\t", class_grades_diff[k][1])
            c = c + 1
        r = r + 1

