Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 64)
64.
How can you read two integers from the console and swap their values?
swap(int(input()), int(input()))
a, b = input("Enter two numbers: ").split(); a, b = b, a; print(a, b)
swap_values(get_integers())
a = input("Enter the first number: "); b = input("Enter the second number: "); swap(a, b)
Answer: Option
Explanation:
To read two integers from the console and swap their values, use a, b = input("Enter two numbers: ").split(); a, b = b, a; print(a, b).
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.