title: How to restart function from nested `if` without duplicating function steps in Python
body: <p>I am learning python from the 'Learn Python the Hard Way' book and at the moment I am tinkering with one of the exercises.</p>
  
  <p>I would like to restart the following function when the nested <code>if</code> statement is <code>True</code> but without repeating the following step (when it asks for the "increment") again. Currently it just does that:</p>
  
  <pre><code>def ask():
      bottom = int(input("Add the lowest element in the list: "))
      top = int(input("Add the highest element in the list: "))
      if top &lt; bottom:
          print("\nThe highest element needs to be greater than the lowest!\n") 
          ask() # This supposed to restart the function
      step = int(input("Add the step by which the list increments: ")) # In case the `if` statement is `True` this step is called twice (or more)
      return(bottom, top, step)
  </code></pre>
  
  <p>I understand that the <code>ask()</code> command repeats the function <em>inside</em> the <code>if</code> statement and, therefore, when it ends, the function continues from where it was 'stopped'. In other words, it calls first the "increment" step from the <code>if</code> statement and, second, from the function itself following the <code>if</code> statement. Unfortunately I did not find a way to escape this.</p>
  
  <p>You can find the whole code <a href="https://pastebin.com/yEu7f2H0" rel="nofollow noreferrer">here</a>.</p>
  
  <p>Any help is appreciated.</p>