How to change variables in Python
<p>I am trying to change a variable further down the program. I have a global variable declared at the start of the program and I want to change the variable in different functions down the program. I can do this by declaring the variable inside the function again but I would like to know is there a better way of doing this. Some test code is below to explain what I mean.</p>

<pre><code>ID = 'No'
project = ("Yep"+ID) #ID added with no value which I later want to change

def pro():

    ID = "YES"
    print ID

def pro1(ID):

    #I could declare project again to get this to work, but I would like to avoid this
    print project # I want this to print with the new ID number.

if __name__ == '__main__':
    pro()
    pro1(ID)
</code></pre>

<p>Has anyone any ideas, thanks</p>

<p>I have tried the 'global' variable but when I do this the project variable still prints out 'YepNo' instead of 'YepYES'. I want the new variable from the function 'pro' to change the variable in the 'project' variable.</p>
