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. 1. Write the function all_equal (L) that receives a list L and determines if all elements in L are equal. Your function must use a for loop. 2. Write the function greater_than_ x(L,x) that receives a list L and an integer x and returns a list containing the elements in L that are greater than x in the order they appear in L. Your function must use a for loop and the append function. 3. Write the function greater_than_ x _lc ( L,x) that receives a list L and an integer x and returns a list containing the elements in L that are greater than x in the order they appear in L. Your function must use list comprehension and no loops or recursion. 4. Write the function split_even_odd_index (L) that receives a list L and returns two lists, one containing the elements of L that have an even index ([L[0], L[2], etc.) and one containing the elements of L that have an odd index. Your function must use a for loop (or more) and the append function. 5. Write the function split_even_odd_index_s (L) that receives a list L and returns two lists, one containing the elements of L that have an even index ( [L[0],L[2], etc.) and one containing the elements of L that have an odd index. Your function must use list slicing and no loops or recursion. 991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351302][]Expectedoutput:Question1TrueTrueFalseFalseTrueQuestion2x=4[5,7,5,7,8,9]x=9[]x=1[2,5,7,1,2,5,7,8,9,0]x=7[8,9]Question3x=4[5,7,5,7,8,9]x=9[]x=1[2,5,7,1,2,5,7,8,9,0]x=7[8,9]Question4[6,8,1,7,2][4,9,3,5,0][40,10,30,50][60,20,80][3,2][1][18,12,6,3][0,9,15][][][2302][]Question5[6,8,1,7,2][4,9,3,5,0][40,10,30,50][60,20,80][3,2][1][18,12,6,3][0,9,15]Step 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