Ask coding questions

← Back to all posts
Python
yallinikumar (0)

How to Add a variable to keep track of how many times your code looped/repeated. At the end of the program, print the number of times the program looped.

Answered by Coder100 (17102) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (17102)

ok

amt = 0
for _ in range(4):
  print("hai")
  amt += 1

print("looped", amt)