Data Validation Using Functions
<p>How do I create a function that validates the following?</p>

<pre><code>def get_order():
    order=int(input("Select an item number: "))
    return order
</code></pre>

<p>I tried this:</p>

<pre><code>def validate_order(order_choice):
    order_choice=get_order()
    return order_choice
    while order_choice &lt; 1 or order_choice &gt; 8:
        order_choice=int(input("Invalid value. Re-enter item number: "))
        return order_choice
</code></pre>

<p>I am confused on how to use parameters correctly. </p>

<p>Thanks!</p>

<pre><code>def get_order():
    order=int(input("Select an item number: "))
    return order
</code></pre>

<p>The validation:</p>

<pre><code>def validate_order(order_choice):
    order_choice=get_order()
    while order_choice &lt; 1 or order_choice &gt; 8:
        order_choice=int(input("Invalid value. Re-enter item number: "))
    return order_choice
</code></pre>

python function validation