Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Python , array wont change after once in iteration(swapping)

Current License: CC BY-SA 4.0

13 events
when toggle format what by license comment
Mar 15, 2020 at 4:55 vote accept harvey choi
Mar 15, 2020 at 1:00 review Close votes
Mar 19, 2020 at 0:00
Mar 15, 2020 at 0:48 comment added Mark @harveychoi this is actually an interesting question, but you've made it hard to understand. You can show a minimal example with just: a[a.index(1)], a[a.index(2)] = a[a.index(2)], a[a.index(1)] — you don't need all the input() business — and then simply ask why it is not swapping elements as you might expect.
Mar 15, 2020 at 0:47 history edited harvey choi CC BY-SA 4.0
added 15 characters in body
Mar 15, 2020 at 0:44 answer added kederrac timeline score: 2
Mar 15, 2020 at 0:43 comment added Prune What is this program supposed to do? Why do you expect other output? It obviously works the way you programmed it -- computers are rather annoying in that respect.
Mar 15, 2020 at 0:42 comment added Prune Please give us a minimal, reproducible example; don't expect every one of us to type input for you.
Mar 15, 2020 at 0:41 comment added harvey choi sorry, I just edited it !
Mar 15, 2020 at 0:38 history edited harvey choi CC BY-SA 4.0
added 126 characters in body
Mar 15, 2020 at 0:37 comment added alkasm Instead of using input(), can you hardcode a known input that fails?
Mar 15, 2020 at 0:36 history edited kederrac CC BY-SA 4.0
added 14 characters in body
Mar 15, 2020 at 0:35 review First posts
Mar 15, 2020 at 0:39
Mar 15, 2020 at 0:34 history asked harvey choi CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /