Given a random list of values, rearrange the list into high/low pairs. use the initial list; do not create a new list. Display the original list and then rearranged list.
Rearranged list description:
highest-value, lowest-value,
next-highest_value, next-lowest,value,
next-highest-value, next-lowest-value,
...
For example if the list contains a even number of elements
[56, 21, 1, 5, 87, 65, 2, 10]
, the results is
[87, 1, 65, 2, 56, 5, 21, 10]
For example if the list contains an odd number of elements
[56, 21, 1, 5, 87, 65, 2]
, the results is
[87, 1, 65, 2, 56, 5, 21]
Use the test lists
test_lists = [ [56,21,1,5,87,65,2,10], # even [87,56,21,1,5,65,10,2], # even [56,21,1,5,87,65,2], # odd [1,21,56], # 3 elements [56,21], # 2 elements [21,56], # 2 elements [199], # 1 element [] # 0 elements ]
Modify project #1 to allow the user to enter a list of string values. Rearrange and display the list.
What does it mean for one string to be greater than another? See collating sequence definition.