Use enumerate
for count,item in enumerate(input_list,1):
# your code
print(count)
2
Or you can increment a counter
while iterating :
count = 0
for i in input_list:
count += 1
# your code
print(count)
2
solved Counting the number of lists that are printed [closed]