title: Iteration question over series of numbers
body: <pre><code>def get_valid_user_input():
      user_input = input(&quot;Enter a number, or leave blank for infinite loop: &quot;)
      if user_input == &quot;&quot;:
          return -1
      try:
          return int(user_input)
      except ValueError:
          print(&quot;Error! Please enter a number or leave blank.&quot;)
          return get_valid_user_input()
  
  my_object = my_func(n=get_valid_user_input())
  while True:
      try:
          print(next(my_object))
      except StopIteration:
          print(&quot;End of Iteration&quot;)
          break
  
  </code></pre>
  <p>Hi I have the above code thanks to seon.</p>
  <p>I want the code to iterate up to 10 times counting as it goes.</p>
  <p>1 3 6 9 etc until it reaches the 10th iteration</p>
  <p>At this point I want a question to be asked do you want to continue the iteration.which would result in am infinite loop..if no then the loop breaks and then an option is sent asking again how many iterations would you like..user enters 3 iterations 1 3 6 9 is printed</p>
  <p>I'm sorry if I'm asking too many questions about the same topic but any advice would be appreciated.</p>
  <p>Thanks</p>