title: Is there a way to count the number of iterations in a while loop in python?
body: <p>I have a really simple while loop that rolls a dice until it rolls a 6. I'm relatively new to python and not sure if there is a method that already exists that I can use to count the number of rolls it takes. The code I have is:</p>
  <pre><code>import random
  
  mace_trans = 0
  while mace_trans != 6:
      mace_trans = random.randint(1, 6)
      print(mace_trans)
  
  </code></pre>