Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 567 Bytes

README.md

File metadata and controls

22 lines (16 loc) · 567 Bytes

Swapping_in_python

Swapping is the most common this in logic designing. swapping in the OG's book.

x = 10
y = 20

temp = x
x = y
y = temp
print(x,y)

Output: 20 10

I agree that the old swapping technique works everytime,but it also increases the amount of code required. So let's learn some new swapping tricks.

Before going into the context lemme tell you the advantage of them,

  • Integrating it into your code can make use of less instances than normally required.
  • Improves logical thanking.
  • Less wastage of resources.