Respuesta :
Program:-
[tex]\tt int(input('Enter\: the\: value\: of\:a:'))[/tex]
[tex]\tt int(input('Enter\:the\:value\:of\:b:'))[/tex]
[tex]\qquad\tt temp=a[/tex]
[tex]\qquad\tt a=b[/tex]
[tex]\qquad\tt b=temp[/tex]
[tex]\tt print('The\:value\:of\:a\:after\: swapping: \{\}'\:.format(a))[/tex]
[tex]\tt print('The\: value\: of\: y\:after\: swapping:\{\}'\:.format(b))[/tex]
Sample Run:-
[tex]\tt a=3[/tex]
[tex]\tt b=5[/tex]
[tex]\tt The\:value\:of\:a\:after\:swapping:5[/tex]
[tex]\tt The\:value\:of\:b\:after\:swapping:3[/tex]
# 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))
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))