Python program to swap two variables

Veröffentlicht am: 18 Juli 2020
auf dem Kanal: MeTechTravelYou
339
14

Variable swapping:
In computer programming, swapping two variables specifies the mutual exchange of values of the variables. It is generally done by using a temporary variable.
For example:
data_item x := 1
data_item y := 0
swap (x, y)
After swapping:
data_item x := 0
data_item y := 1

See this example:
Python swap program
x = input('Enter value of x: ')
y = input('Enter value of y: ')

create a temporary variable and swap the values
temp = x
x = y
y = temp
print('The value of x after swapping: {}'.format(x))
print('The value of y after swapping: {}'.format(y))

python basic playlist
   • Python All programs.  

Python program to display calendar.
   • Python program to display calendar.  

#python program to swap two values,
#program to swap two variables in python,
#python program to swap two numbers,
#write a python program to swap two numbers

Email:princessayushi777@gmail.com
facebook:-
https://www.facebook.com/Ayushis-Acad...
instagram:-
  / ayushi__academy  
twitter
https://twitter.com/AcademyAyushi?s=09


Auf dieser Seite können Sie das Online-Video Python program to swap two variables mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer MeTechTravelYou 18 Juli 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 339 Mal angesehen und es wurde von 14 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!