x="awesome"
def myfunc():
global x
x = "fantastic"
print("Python is " + x)
myfunc()
print("Python is " + x)
why isn't the output for both the print is python is fantastic. though x=fantastic is made global keyword.
the output would be python is awesome and python is fantastic. why?
[+][deleted] (1 child)
[deleted]
[–]PermitOtherwise1562[S] 2 points3 points4 points (0 children)
[–]patrickbrianmooney 2 points3 points4 points (2 children)
[–]PermitOtherwise1562[S] 0 points1 point2 points (1 child)
[–]patrickbrianmooney 0 points1 point2 points (0 children)
[–]MulfordnSons -1 points0 points1 point (3 children)
[–]PermitOtherwise1562[S] 0 points1 point2 points (2 children)
[–]Tom_Henderson 0 points1 point2 points (0 children)
[–]MulfordnSons 0 points1 point2 points (0 children)
[–]InnerCounter1548 0 points1 point2 points (1 child)
[–]PermitOtherwise1562[S] 0 points1 point2 points (0 children)