Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wordList = []
- for items in range(5):
- words = input("Enter a word: " )
- wordList.append(words)
- numList = 1
- for x in wordList:
- print(numList,x)
- numList += 1
- print("Do you want to swap any 2 items? ")
- wantSwap = input("y = yes, anything else = no: ")
- while wantSwap.upper() == "Y":
- numList -= 5
- w1 = int(input("Enter the first number to swap: ")) -1
- w2 = int(input("Enter the second number to swap: ")) -1
- wordList[w1], wordList[w2] = wordList[w2], wordList[w1]
- print("Here is the revised list:")
- for x in wordList:
- print(numList,x)
- numList += 1
- print()
- print("Do you want to do it again? ")
- wantSwap = input("y = yes, anything else = no: ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement