Computer Science, asked by Ddv08, 1 year ago

Hello everyone,
☺️

Write a statement to swap a &b (numbers in a list ) without using any temporary variable.

# Python


abhi2805: apni pic ਲਗਾਓ
abhi2805: yes
abhi2805: apni pic lgao
abhi2805: why
abhi2805: आप मेरी GF bn जाओ
abhi2805: btao

Answers

Answered by BrainlyTech
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⭐


BrainlyTech: thx for marking brainliest much love
BrainlyTech: no problem
abhi2805: hlo Ddv
Answered by BERACAH
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