Suppose you have a sitting arrangement of the students who will give the final exam in a list. The list contains the last two digits of their student ID as given below. [10,30,20,70,11,15,22,16,58,100,12,56,70,80] Now you want to organize the sitting arrangement of the students in your own way. You decide to sort all the students in the even indices of the list in ascending order and all the students in the odd indices of the list in descending order. So, write a python program that organizes the list for you in this way. [You cannot use python build-in sort() function, you can call your own sort function or copy your code from previous tasks instead] =============================================================== Output: [10, 100, 11, 80, 12, 70, 20, 56, 22, 30, 58, 16, 70, 15] def task4(list_in): # YOUR CODE HERE return list_out * please use list_in andreturn list _out also no sort() function, thank you so much for your help
Suppose you have a sitting arrangement of the students who will give the final exam in a list. The list contains the last two digits of their student ID as given below.
[10,30,20,70,11,15,22,16,58,100,12,56,70,80]
Now you want to organize the sitting arrangement of the students in your own way. You decide to sort all the students in the even indices of the list in ascending order and all the students in the odd indices of the list in descending order.
So, write a python program that organizes the list for you in this way.
[You cannot use python build-in sort() function, you can call your own sort function or copy your code from previous tasks instead]
===============================================================
Output:
[10, 100, 11, 80, 12, 70, 20, 56, 22, 30, 58, 16, 70, 15]
def task4(list_in):
# YOUR CODE HERE
return list_out
* please use list_in andreturn list _out
also no sort() function, thank you so much for your help
Step by step
Solved in 4 steps with 2 images