Python Programming - Tricky Questions - Discussion
Discussion Forum : Tricky Questions - General Questions (Q.No. 25)
25.
What will be the output of the following Python code?
def func(x):
x += 1
return x
x = 5
result = func(x)
print(x, result)
Answer: Option
Explanation:
The function modifies its local copy of
x
, and the global x
remains unchanged.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers