Python Programming - Variables - Discussion
Discussion Forum : Variables - General Questions (Q.No. 22)
22.
What is the output of the following code:
x = 10
y = 5
x, y = y, x
print(x, y)Answer: Option
Explanation:
In this code, two variables x and y are assigned the values 10 and 5 respectively.
The third line swaps the values of the variables using the tuple packing and unpacking technique.
When the variables are printed to the console, the output is 5 10.
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