Write a Python program to Swap two variables


Introduction

Write a Python program to Swap two variables. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. a = 50
  2. b = 30
  3. print("\nBefore swap a = %d and b = %d" %(a, b))
  4. a, b = b, a
  5. print("\nAfter swaping a = %d and b = %d" %(a, b))
  6. print()
  7.  

Result

python language techstudy.org

     





Related Topics




Popular Posts