Question
Write Python script to input two numbers from the user and store these values in two different variables. Then interchange (swap) the values of these two variables using a third variable.

Answer

"'Python script to input two numbers from the user and store these values in two different variables. Then interchange (swap) the values of these two variables without using a third variable."'
a=int(input("Enter the first number"))
b=int(input("Enter the second number"))
temp=a
a=b
b=temp
print("Numbers after the swaps are ",a ," , ",b)

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free