Skip to content

Commit 21917b3

Browse files
authored
Create Swapping two numbers
1 parent 99cf7d7 commit 21917b3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎Swapping two numbers‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Python code to swap two numbers
2+
# without using another variable
3+
4+
5+
x = 5
6+
y = 7
7+
8+
print ("Before swapping: ")
9+
print("Value of x : ", x, " and y : ", y)
10+
11+
# code to swap 'x' and 'y'
12+
x, y = y, x
13+
14+
print ("After swapping: ")
15+
print("Value of x : ", x, " and y : ", y)

0 commit comments

Comments
 (0)