Advertisement
lessientelrunya

swap0

Jun 30th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. def main():
  2.     x = 1
  3.     y = 2
  4.  
  5.     print("x is {}".format(x))
  6.     print("y is {}".format(y))
  7.     print("Swapping...")
  8.     swap(x, y)
  9.     print("Swapped.")
  10.     print("x is {}".format(x))
  11.     print("y is {}".format(y))
  12.  
  13. def swap(a, b):
  14.     tmp = a
  15.     a = b
  16.     b = tmp
  17.  
  18. if __name__ == "__main__":
  19.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement