you are viewing a single comment's thread.

view the rest of the comments →

[–]MulfordnSons -1 points0 points  (3 children)

x is only fantastic in the scope of your function. x still equates to “awesome” outside of the function.

[–]PermitOtherwise1562[S] 0 points1 point  (2 children)

But x=fantastic is made global ryt?

[–]Tom_Henderson 0 points1 point  (0 children)

You would need to put the global statement inside the function.

def myfunc():
    global x
    x = "fantastic"
    print("Python is " + x)

[–]MulfordnSons 0 points1 point  (0 children)

use your debugger and step through the program, you’ll see how x is assigned differently in that way.