Reference no: EM133240744
Assignment - Need help with Python
Description - Write a program that takes keeps taking characters from the user till an 'x' is entered. Put each character in the list. Show the list.
Once the list is complete (i.e. x is entered in the list), tell the user how many members are in the list. Then ask the user if they want to swap any two indices. Take the index positions as input from the user, swap the elements, show the list, and that ends the program.
Sample Output:
Please enter a character in the list: a
Please enter a character in the list: b
Please enter a character in the list: c
Please enter a character in the list: d
Please enter a character in the list: e
Please enter a character in the list: x
Your list is ['a', 'b', 'c', 'd', 'e', 'x']
Which two indices do you want to exchange?
Index 1: 2
Index 2: 4
Your new list is ['a', 'b', 'e', 'd', 'c', 'x']