Answer:
In Python:
def swap(number1,number2):
a = number1
number1 = number2
number2 = a
return number1, number2
first = float(input("First Number: "))
second = float(input("Second Number: "))
print("After Swap: "+str(swap(first,second)))
Step-by-step explanation:
The swap function begins here
def swap(number1,number2):
This saves number1 into variable a
a = number1
This saves number2 into number1
number1 = number2
This saves a (i.e. the previous number1) to number2
number2 = a
This returns the numbers (after swap)
return number1, number2
The main begins here
The next two lines prompt the user for first and second numbers
first = float(input("First Number: "))
second = float(input("Second Number: "))
This calls the swap function and print their values after swap
print("After Swap: "+str(swap(first,second)))