title: How can I make this loop keep going until the correct input is entered?
body: <p>This is the code that I have written, I am learning python right now but tell me how can I make this loop keep on going until we hit the correct condition that is x and y are both integers and y &gt; 0, so that it won't be able to throw an exception.</p>
  <pre><code>def problem_2():
      while True:
          try:
              x = int(input(&quot;Enter the value of X&quot;))
              y = int(input(&quot;Enter the value of Y&quot;))
              print(x/y)
          except ZeroDivisionError:
              print(&quot;You have divided the number by zero&quot;)
          except TypeError:
              print(&quot;Please Enter Integer in both the cases&quot;)
  
  problem_2()
  </code></pre>