Is it necessary to assign the value of col=1 inside the while loop?

can’t we do the assigning of col variable outside the loop?

@snigdha_8 we need to intialize col = 1 for all the rows. So you can declare col outside the loop, but you must redefine its value as 1 inside the loop for each row