Swapping of two numbers in python | IDLE SHELL | PYTHON

Published: 11 February 2023
on channel: We Are Programmers
95
3

Python program to swap two variables

x = 5
y = 10

To take inputs from the user
#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))


On this page of the site you can watch the video online Swapping of two numbers in python | IDLE SHELL | PYTHON with a duration of hours minute second in good quality, which was uploaded by the user We Are Programmers 11 February 2023, share the link with friends and acquaintances, this video has already been watched 95 times on youtube and it was liked by 3 viewers. Enjoy your viewing!