What is the output of the following program:
a = 9
b = 2
a,b = b,a
print(f"a is {a} and b is {b}")
Answers
Answered by
0
Answer:
9,2 cannot be equal to 2,9 and answer is it will print a is 9 and b is 2
Answered by
3
Required Answer:-
Given C∅de Snippet:
a = 9
b = 2
a,b = b,a
print(f"a is {a} and b is {b}")
To Find:
- The output of the given c∅de snippet.
Output:
→ a is 2 and b is 9
Explanation:
→ Initially, the values of a and b are 9 and 2 respectively.
→ In the third line, the values of a and b are swapped.
→ Then, a becomes 2 and b becomes 9.
→ In the fourth line, values of a and b are displayed.
→ So, the output is - "a is 2 and b is 9"
Attachments:
Similar questions