Hello everyone,
☺️
Write a statement to swap a &b (numbers in a list ) without using any temporary variable.
# Python
abhi2805:
apni pic ਲਗਾਓ
Answers
Answered by
2
x = 10
y = 5
# Code to swap 'x' and 'y'
# x now becomes 15
x = x + y
# y becomes 10
y = x - y
# x becomes 5
x = x - y
print("After Swapping: x =",x ," y =", y);
hope this helped you
⭐Mark as brainliest⭐
Answered by
1
Let a,b Are Two Variables
Then,
Try The Following Command Is The Method For Swaping Two Variables Without Temporary Variable
a,b=b,a
Similar questions
Social Sciences,
7 months ago
Computer Science,
7 months ago
Computer Science,
7 months ago
Math,
1 year ago