What is the expected behavior of the following snippet? It will:

Select an option, then click Submit answer.
Reference / correct answer:
Most accepted answer: D. print 3
Community votes: D=3
I know we shouldn't use function name same as variable name. But if I run the code the result is 3. Why? upvoted 5 times lasagne394 5 years, 11 months ago Because during an assignment, the RHS is evaluated first and the result is assignment to the given identifier. In this case, the `x` on the RHS was a function and the result (1 + x() = 1 + 2) was REASSIGNED/BOUND to the same identifier. Post reassignment, x is bound to a int literal, while before it was bound to a function. I hope this snippet will help: https://prnt.sc/u1u8ki upvoted 12 times clacot 5 years, 11 months ago clear now. Thanks! upvoted 1 times ... ...
Because during an assignment, the RHS is evaluated first and the result is assignment to the given identifier. In this case, the `x` on the RHS was a function and the result (1 + x() = 1 + 2) was REASSIGNED/BOUND to the same identifier. Post reassignment, x is bound to a int literal, while before it was bound to a function. I hope this snippet will help: https://prnt.sc/u1u8ki upvoted 12 times clacot 5 years, 11 months ago clear now. Thanks! upvoted 1 times ...
clear now. Thanks! upvoted 1 times
Selected Answer: D Selected Answer: D upvoted 1 times
Selected Answer: D def x(): #x_function return 2 x=1+x() #x_value=use x_function print(x) #-->3 def x(): #x_function return 2 x=10 #x_value=int x=1+x() #x_value=use not exist x_function print(x) #-->TypeError: 'int' object is not callable upvoted 1 times