Exercise: Swap Two Variables

  1. Write a program swap.py that exchanges (swaps) two variables var1 and var2, both str type.

    To output the values before and after the swap operation, use the print() function.

    var1 = 1
    var2 = 2
    
    print('Before:', var1, var2)
    # let the miracle happen: exchange the two variables!
    print('After:', var1, var2)
    

    Once the miracle took place, the output of the program should look like follows:

    $ python swap.py
    Before: 1 2
    After: 2 1