1 point Two variables X and Y were assigned the following values initially. X = 3 and Y = 6. Which of the following statements will help swap the values between these two variables?
a. Y = X X = Y
b. X = Y
c. X = Y Y = X
d. X, Y = Y, X
Answers
Answered by
0
Explanation:
What is mean by accuracy
Attachments:
Answered by
0
The correct statement to swap the numbers is (d) X, Y = Y, X.
Explanation:
- In general in order to swap the values stored in two variables we require a third variable.
- This third variable acts as a temporary storage variable for carrying out the swapping operation.
- However, in the python programming language, the swapping can be done without the help of a third variable acting as temporary storage space.
- For example, X, Y = Y, X will put the value of X in Y and vice-a-versa.
Similar questions