Function that replaces for loop counter Python
Posted By: Anonymous Is there a way of outputting the number of iterations without using the counter variable? values= ["4","a","rk","sp"] counter = 0 for k in values: print("counter: ",counter, "value: ", k) counter +=1 Solution enumerate would work well here: values= ["4","a","rk","sp"] for count, k in enumerate(values): print("counter: ", count, "value: ", k) The purpose …