Swap Two Values
Python
Easy
2 views
Problem Description
Read two integers a and b. Swap them and output the swapped values. Use Python multiple assignment.
Input Format
One line: a b (space separated).
Output Format
One line: swapped_a swapped_b.
Official Solution
import sys
s=sys.stdin.read().strip().split()
if not s: sys.exit(0)
a=int(s[0]); b=int(s[1])
a,b=b,a
sys.stdout.write(f"{a} {b}")
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!