Header Ads

How to Swap Two Number With and Without Using Third Variable in Python

Swap Values in Two Variables

Suppose We Have Two Variable a and b. I want to exchange value of these two variable using third variable or without Using third variable
Example: 
a = 10
b = 20
we want to change the value of these two variable. The 20 is store in variable a and 10 is store in variable b
 a = 20
 b =10



There are two method we used

  • with using third variable
  • without using third variable
With Using Third Variable
In this method we use third variable called temporary variable called temp

Example: Code Program

swap,swapping,swaping,value,third,with,without,Python program,swapping two number,with and without third,without third variable,How to you swap two variables,How do you swap value in python,How do you swap values without a third variable,swapping two Numbers without Using Third Variable in python,How can I swap two number without using third number in python,How do you write program to swap two number without using third,swapping two Numbers without Using Third




With Out Using Third Variable

Example: Code Program
swap,swapping,swaping,value,third,with,without,Python program,swapping two number,with and without third,without third variable,How to you swap two variables,How do you swap value in python,How do you swap values without a third variable,swapping two Numbers without Using Third Variable in python,How can I swap two number without using third number in python,How do you write program to swap two number without using third,swapping two Numbers without Using Third

No comments

Powered by Blogger.