Here is my code :
x = 1
def poi(y):
# insert line here
def main():
print poi(1)
if __name__ == "__main__":
main()
If following 4 lines are placed, one at a time, in place of # insert line here
Lines | Output
---------------+--------------
1. return x | 1
2. x = 99 |
return x | 99
3. return x+y | 2
4. x = 99 | 99
In above lines it seems that global x declared above function is being used in case 1 and 3
But ,
x = x*y
return x
This gives
error : local variable 'x' is reference before assignment
What is wrong in here ?