Write a Python program to Swap two variables
I have used python 3.7 compiler for debugging purpose.
a = 50 b = 30 print("\nBefore swap a = %d and b = %d" %(a, b)) a, b = b, a print("\nAfter swaping a = %d and b = %d" %(a, b)) print()
Result:
Before swap a = 50 and b = 30
After swaping a = 30 and b = 50
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
I have used python 3.7 compiler for debugging purpose.
Result:
Before swap a = 50 and b = 30
After swaping a = 30 and b = 50
need an explanation for this answer? contact us directly to get an explanation for this answer