Samuel Vermeulen 4 weeks ago
parent
commit
5a2a53b466
  1. 13
      banquet.py

13
banquet.py

@ -1,6 +1,7 @@
nbPersonnes = int(input())
nbChangPosition = int(input())
position = [0] * nbPersonnes
positionTemp = [0] * nbPersonnes
for loop in range(nbPersonnes):
position[loop] = int(input())
@ -9,9 +10,13 @@ for loop in range(nbChangPosition):
pos1 = int(input())
pos2 = int(input())
personneA = position[pos1]
personneB = position[pos2]
positionTemp[pos1] = position[pos2]
positionTemp[pos2] = position[pos1]
position[pos1] = positionTemp[pos1]
position[pos2] = positionTemp[pos2]
print()
for loop in range(nbPersonnes):
print(position[loop])
Loading…
Cancel
Save