Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help in Python implementing these certain lists. using the format displayed below with the expected outcomes below. Write the following functions. See the commented
Need help in Python implementing these certain lists. using the format displayed below with the expected outcomes below.
Write the following functions. See the commented out part of the program for expected results. Also, make sure your functions don't modify the list L received as parameter. 6. Write the function split_even_odd (L) that receives a list L and returns two lists, one containing the elements of L that are even and one containing the elements of L that are odd. Your function must use a for loop (or more) and the append function. 7. Write the function split_even_odd_lc (L) that receives a list L and returns two lists, one containing the elements of L that are even and one containing the elements of L that are odd. Your function must use list comprehension and no loops or recursion. 8. Write the function split middle (L) that receives a list L and returns two lists, one containing the first half of L and one containing the second half of L. Your function must use list slicing and no loops or recursion. 9. Write the function split_pivot (L) that receives a list L and returns two lists, one containing the elements of L that are less than L [0] and one containing the elements of L that are greater or equal to L [0]. If L is empty, your function must return two empty lists. Your function must use a for loop and the append function. 10. Write the function split_pivot_lc (L) that receives a list L and returns two lists, one containing the elements of L that are less than L [0] and one containing the elements of L that are greater or equal to L[0]. If L is empty, your function must return two empty lists. Your function must use list comprehension and no loops or recursion. \begin{tabular}{l|l} 17 & \\ 18 & def \\ 19 & split_even_odd(L): \\ even,odd= [], [] \\ 20 & return even, odd \\ 21 & \\ 22 & def split_even_odd_lc(L): \\ 23 & return [], [] \\ 24 & \\ 25 & def split_middle(L): \\ 26 & return [], [] \\ 27 & \\ 28 & def split_pivot(L): \\ 29 & left, right = [], [] \\ 30 & return left, right \\ 31 & def split_pivot_lc(L): \\ 32 & return[], [] \end{tabular} 138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173Question6[6,4,8,2,0][9,1,3,7,5][40,60,10,20,30,80,50][][2][3,1][18,0,12,6][9,15,3][][][2302][]Question7[6,4,8,2,0][9,1,3,7,5][40,60,10,20,30,80,50][][2][3,1][18,0,12,6][9,15,3][][][2302][]Question8[6,4,8,9,1][3,7,5,2,0][40,60,10][20,30,80,50][3][1,2][18,0,12][9,6,15,3][][][][2302]Question9[4,1,3,5,2,0][6,8,9,7][10,20,30][40,60,80,50][1,2][3][0,12,9,6,15,3][18][][][][2302]Question10[4,1,3,5,2,0][6,8,9,7][10,20,30][40,60,80,50][1,2][3][0,12,9,6,15,3][18][][][][2302]110Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started