count = 0 command = "" while command != "quit": command = input("Enter a command: ") count = count + 1 print(f"Loop has repeated {count} times.")
count
is initialized to 0, and increases by 1
on each iteration of the loop. Incrementing is not restricted to
increasing by 1, but can be done with any arbitrary math expression.
Example:
count = count * -5 / 2 - 1
Your code
Your code
Your code
Your code
Your code
Your code