title: How would I go about creating an input input that restarts the code from the users end?
body: <p>I am looking for a way to include an input at the end of this code where the user will be prompted with a choice to restart the code or end the code without having to manually restart it.</p>
  <pre><code>def correct_result(choice,num):
  if choice.lower() == 'square':      #Prints the Square of a number Ex. 2^2 = 4
      return num**2
  
  elif choice.lower() == 'sqrt':      #Prints the Square root of a number Ex. √4 = 2 
      return num**.5
  
  elif choice.lower() == 'reverse':   #Changes the sign of the number
      return(-num)
  
  else:
      return 'Invalid Choice'         #prints an error message
  
  choice = input()                  #Creates a answer box to enter the desired choice
  num = int(input())                #Creates a second box that lets the user enter their number
  print(correct_result(choice,num)) #Prints either the desired choice or the error function
  </code></pre>