This is python program to swap two numbers given by user as input –
1 2 3 4 5 6 7 8 |
a=input("enter first number") b=input("enter second number") print(f"numbers before swapping: a={a},b={b}") a,b=b,a print(f"numbers after swapping: a={a},b={b}") |
Tags: python basic programs, python swap two, top python,