where we can use swapping values program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

where we can use swapping values program?

let us find how we can implement "swapping values" program in our other programs. ok idea number 1.=>> if we have to output the small number in specific variable. please tell if you can think other and enjoy the following code https://code.sololearn.com/cOjdaU29Gy8q/?ref=app

23rd Nov 2020, 9:23 AM
Ankit Nainwal
Ankit Nainwal - avatar
5 Answers
+ 4
That's not how swapping values works. Check this out. a = 1 b = 5 a,b = b,a print(a,b) # output: 5 1
23rd Nov 2020, 9:25 AM
Slick
Slick - avatar
+ 1
First of all, I suggest you to use int(input()), not input(). For swapping, you can just simply do x, y = y, x.
23rd Nov 2020, 9:24 AM
LastSecond959
LastSecond959 - avatar
+ 1
What do you think pranks are?
23rd Nov 2020, 9:49 AM
Slick
Slick - avatar
+ 1
Slick the prank is that, there is no prank 🤪
24th Nov 2020, 8:36 AM
Ankit Nainwal
Ankit Nainwal - avatar
0
Slick ,yes but thats why I stated "prank", as it was only displaying other variables
23rd Nov 2020, 9:40 AM
Ankit Nainwal
Ankit Nainwal - avatar