How to swap two elements with each other from a single list in python?

前端 未结 0 1161
-上瘾入骨i
-上瘾入骨i 2020-11-21 16:50

I wrote this. But i want to swap mylist=[2,1,5,0] elements like 2 will swap with 1, then 2 will swap with 5, then 2 will swap with 0

so the output will be :

相关标签:
回答
  • 消灭零回复
提交回复
热议问题