how to limit input in while loop need serious looking into
<p>how can i limit the input for srj imbetween 1 and 0 and it just restarts the whole program</p>

<pre><code>def gen0():      # input all the initial data
    while True:  # this will loop infinitely if needed
        try:     # this will try to take a float from the user
            j=int(input('how many juveniles are there in generation 0? '))
            srj=float(input('what is the survival rate of juveniles '))
            break             # if the user gives a number then break the loop
        except ValueError:    #if the user does not give a number then the user will be told to retry
            print("Sorry, there was an error. Please enter a positive number")
</code></pre>

<p>put the if statement <code>if srj &gt; 1 or srj &lt; 0:gen0()</code> before the <code>break</code> line<br>
:^)</p>

python while-loop