Can someone help me solve this? I need to return a single list. Not 2 separate lists. I also need to modify a list of numbers.
Function 3: In this function you must both return a value and
modify in-place the input
parameter (when needed). The only functions you are allowed to use
are range(), len(),
append(), insert(), remove(), pop() and the del keyword.
• Examples:
return value argument value after return
◦ func3([4,-3,7,-5,1]) → [-3,-5] [4,7,1]
◦ func3([4,-3,7,-5,1], 4) → [-3,-5,1] [4,7]
◦ func3([4,-3,7,-5,1], 10) → [4,-3,7,-5,1] [ ]

def func3(numbers, t=0):
lower = []
higher = []
for num in numbers:
if num < t:
lower.append(num)
else:
higher.append(num)
return [lower, higher]
print(func3([4, -3, 7, -5, 1]))
print(func3([4, -3, 7, -5, 1], 4))
print(func3([4, -3, 7, -5, 1], 10))

def func3(numbers, t=0):
lower = []
higher = []
for num in numbers:
if num < t:
lower.append(num)
else:
higher.append(num)
lower.extend(higher)
return lower
print(func3([4, -3, 7, -5, 1]))
print(func3([4, -3, 7, -5, 1], 4))
print(func3([4, -3, 7, -5, 1], 10))
Can someone help me solve this? I need to return a single list. Not 2 separate...
Can some help me solve these? I am confused on where to start. I know in some cases, since there are no arguments, I can use *. Function 3: In this function you must both return a value and modify in-place the input parameter (when needed). The only functions you are allowed to use are range(), len(), append(), insert(), remove(), pop() and the del keyword. • Examples: return value argument value after return ◦ func3([4,-3,7,-5,1]) → [-3,-5] [4,7,1] ◦ func3([4,-3,7,-5,1],...
Based on the following examples of function calls and the respective return values, guess what are the signatures of the functions and then implement them. You are not allowed to use: a) modules, b) slicing, c) aliases, d) the list comprehension syntax (if you don’t know what that is then you can’t use it either). Function 3: In this function you must both return a value and modify in-place the input parameter (when needed). The only functions you are allowed...
Can someone solve these for me using only len(), range(), append(), and del keyword when needed as the directions state? No list comprehension, slicing, or importing modules. No chr or index(i) functions. def reduce_matrix(mat) • Reduces the size of matrix mat in half, in both dimensions, by merging adjacent elements • The new values of the matrix are the average of the respective merged elements • Return value is None. Variable mat is directly modified in memory • mat is...
def append_length(my_list): """ Append the length to a list Finish this function which gets the length of a list, then append the length (as an integer) to the list. For example, if the parameter my_list is [0,1,2,3], after running this function, a 4 will be appended to this list: [0, 1, 2, 3, 4] This function does not have any explicit return value. Micro-credential(s): - Applying basic operations/operators (including len(), concatenation, repetition and in operator) to lists - Adding an...
Fit to page ID Page view A Re - + of the cropped tile, width (int) is the width of the cropped tile Retur ed image that is a 3D list of int Example crop ([ LLU ,1, ,2,2), (3,3,3]], [(4,4,4], [5,5,5),(6,6,6]], [[7,7,7], [8,8,8], [9,9,9]] ), (0,0), 1, 2) [[[1,1,1], [2,2,2]]] color2gray(image) Description: It takes a color image (3D list) and returns a new grayscale image (2D list) where each pixel will take the average value of the three color...
C++ Assignment Project 1 - NodeList Building upon the the ListNode/List code I would like you to extend the interface of a list to have these member functions as well. struct ListNode { int element; ListNode *next; } Write a function to concatenate two linked lists. Given lists l1 = (2, 3, 1)and l2 = (4, 5), after return from l1.concatenate(l2)the list l1should be changed to be l1 = (2, 3, 1, 4, 5). Your function should not change l2and...
// I need help with the following questions. Please use java programming ECLIPSE language to solve the questions. YOU ONLY NEED TO DIRECTLY COPY IT IN YOUR ECLIPSE APPLICATION AND RUN IT. I NEED THOSE PART WHICH IS SAYS --> "TO BE COMPLETED" I NEED HELP WITH [GET*] AND [REPLACE ALL] AND [ADD INT DOUBLE] PLEASE. import java.util.ArrayList; public class CustomArrayList { //instance variables public int[] data; //data.length gives the capacity public int nItems; //nItems gives items currently in the...
C++ Assignment Project 1 - NodeList Building upon the the ListNode/List code I would like you to extend the interface of a list to have these member functions as well. struct ListNode { int element; ListNode *next; } Write a function to concatenate two linked lists. Given lists l1 = (2, 3, 1)and l2 = (4, 5), after return from l1.concatenate(l2)the list l1should be changed to be l1 = (2, 3, 1, 4, 5). Your function should not change l2and...
I need help modifying this python code: a) I need to take 2 attributes of the data as int - (columns (3 & 5) of my data) b) I need to take 2 more attributes as floats -(columns 4&6 of my data) c) I need to take 1 attribute as string (column 16 of my data) How would I modify this code # # Initial version - "standard programming" # # Define a list for the data. The data structure...
can someone please double check my code here are the requirements please help me fulfill the requirements Using the material in the textbook (NumberList) as a sample, design your own dynamic linked list class (using pointers) to hold a series of capital letters. The class should have the following member functions: append, insert (at a specific position, return -1 if that position doesn't exist), delete (at a specific position, return -1 if that position doesn't exist), print, reverse (which rearranges...