Input value between x and y
<p>So I need to gather input from a user but I have to ensure that they can only enter a number between 1 and 0 before the program accepts their input.
Here is what I've got so far:</p>

<pre><code>def user_input():
    try:

        initial_input = float(input("Please enter a number between 1 and 0"))

    except ValueError:

        print("Please try again, it must be a number between 0 and 1")
        user_input()
</code></pre>

<p>Could someone edit this or explain to me how I can add another rule as well as the <code>ValueError</code> so that it only accepts numbers between 1 and 0?</p>