Question
 Rewrite the above script, but this time to swap the values of variables without using the 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"))
a,b=b,a
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