How do I transfer varibles through functions in Python
<p>I am trying to read from keyboard a number and validate it</p>

<p>This is what I have but it doesn't work. </p>

<p>No error but it doesn't <strong>remember</strong> the number I introduced</p>

<pre><code>def IsInteger(a):
    try:
        a=int(a)
        return True
    except ValueError:
        return False 

def read():
    a=input("Nr: ")
    while (IsInteger(a)!=True):
        a=input("Give a number: ")

a=0
read()
print(a)
</code></pre>

<p>It appears as though you are not returning the result of the read() function.</p>

<p>The last line of your read function should be "return a"</p>

<p>And then when you call the read function you would say "a = read()"</p>

python variables