Nov-29-2021, 08:17 PM
Hello,
here's a simplified version of what's causing me trouble :
Thank you !
here's a simplified version of what's causing me trouble :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
x = int def init(): # x = 0 return def f(): x + = 1 return init() f() f() print (x) |
Error:8: Local variable 'x' defined in enclosing scope on line 1 referenced before assignement
What does this error mean in this context ? Aren't variables defined outside of functions set to global by default ? Thank you !