Python Program to Swap Two Variables|With Using Temporary Variable||Without Using Temporary variable

preview_player
Показать описание
The above video is to swap two variables with and without using temporary variable.If you have any doubts or queries related to python ,post them in the comments section.Also remember that programming is much about the concept and practice.You can go through my videos to practice basic python programs.
The above program can be written in two ways:
-with temporary variable
-without temporary variable

WITH TEMPORARY VARIABLE:
-Firstly assign the value of first variable to a temporary variable.
-Then assign the value of second variable to the first variable.
-Now assign the temporary variable to the second variable.
-Finally print the values and see the magic.

WITHOUT TEMPORARY VARIABLE:
This again can be written in two ways:
-By arithmetic operations.
-By directly interchanging and assingning the values of the variables.Also remember that this methid can be used only in python and cannot be applied in other programming languages.
Рекомендации по теме
join shbcf.ru