Swap two numbers in python. In the Python programming language, there is a program that swaps two numbers. In a Python program, this program can swap values. It is possible to change the value without using the temp variable or the third variable in the Python programming language.
Swap Two Numbers Definition
The term “swapping two variables” refers to the process of exchanging the values of the variables. In most cases, this is done with the data in memory. In Python, you can simply swap values without using a temporary variable (temporary variable). It is possible to swap variable values as well as values (items) in a list.
Print Statement in Python
The print() function outputs the message supplied to the screen or another standard output device. The message can be a string or any other object; the object will be converted to a string before being displayed on the screen.
x = 100 y = 200 x, y = y, x print ("after swapping") print("Value of x = ", x, " and y =", y)
After swapping Value of x = 200 and y = 100