Min-Max Tuple
Completed
Read a line of integers. Make a tuple (smallest, largest), print it, then unpack it into two variables and print their difference.
Input
One line of space-separated integers.
Output
Two lines: the tuple, then largest − smallest.
Example
Input
4 9 1 7
Output
(1, 9) 8
Editor
Python
Hints
Tuples use parentheses.
low, high = pair unpacks the tuple.
Solution explanation
Tuples group values that belong together; unpacking gives each part a name.
Show solution
nums = list(map(int, input().split()))
pair = (min(nums), max(nums))
print(pair)
low, high = pair
print(high - low)