Question: Consider a variable called my_list which refers to a list with at least one element. Which of the following statements correctly creates a list with
Consider a variable called my_list which refers to a list with at least one element. Which of the following statements correctly creates a list with only half of the elements from my_list? (if the number of elements is odd, then the number of selected elements can be rounded down or up.) Select all that apply. my_list = my_list[::2] my_list[:len(my_list) //2] = ] my_list[len(my_list)//2] = my_list[0] my_list(len(my_list)//2:] = my_list[:len(my_list)//2] my_list = my_list[len(my_list)//2::2]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
