employer cover photo
employer logo
employer logo

Tata Consultancy Services

Fait partie de Tata Group

Employeur impliqué

Question d’entretien chez Tata Consultancy Services

Write a program to swap two numbers using python? Since I mentioned before that my favorite programming language is python so the interviewer asked me to solve the coding question using python language.

Réponse à la question d'entretien

Utilisateur anonyme

21 nov. 2024

# Swap two variables in Python a=int(input(“Enter value : “)) b=int(input(“Enter value : “)) print(“Before swapping a :”,a) print(“Before swapping b :”,b) #logic to swap using third variable temp=a a=b b=temp print(“After swapping a becomes :”,a) print(“After swapping b becomes :”,b)