Question

Can some help me solve these? I am confused on where to start. I know in...

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], 4) → [-3,-5,1] [4,7]
◦ func3([4,-3,7,-5,1], 10) → [4,-3,7,-5,1] [ ]

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def func3(numbers, t=0):
    less, high = [], []
    for num in numbers:
        if num < t:
            less.append(num)
        else:
            high.append(num)
    return [less, high]


print(func3([4, -3, 7, -5, 1]))
print(func3([4, -3, 7, -5, 1], 4))
print(func3([4, -3, 7, -5, 1], 10))

Add a comment
Know the answer?
Add Answer to:
Can some help me solve these? I am confused on where to start. I know in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can someone solve these for me using only len(), range(), append(), and del keyword when needed...

    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...

  • hi i dont know and understand what this assignment wants me to do can some please...

    hi i dont know and understand what this assignment wants me to do can some please explain it to me thank you Modify the print_face function to have a third parameter mouth and use it in the final print statement. def print_face(eye, face_char): print(' ', eye, ' ', eye) # Print eyes print(' ', face_char) # Print nose print(' ', face_char*5) # Print mouth return print_face('o', 'x')

  • Fit to page ID Page view A Re - + of the cropped tile, width (int)...

    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...

  • I am confused, can you help me solve? Thank you Based on the traditional criterion (p...

    I am confused, can you help me solve? Thank you Based on the traditional criterion (p < .05). Would p-value of 0.4 be considered statistically significant?

  • when i run it is still be "false" i don't know why. could you help me...

    when i run it is still be "false" i don't know why. could you help me fix it and tell me which part is wrong??? specific answer is better thanks!!! Problem 6: (4 pts): Write a function that takes as an input parameter a string. It should return a Boolean value indicating whether the string is a palindrome or not. INPUT: “mom"->true “palindrome”->false “amanaplanpanama"->true 3 #include <iostream> #include <string.h> I using namespace std; string function(string str); int main() { function("palindrome");...

  • i am very confused with these questions. can someone help me solve? and can you explain...

    i am very confused with these questions. can someone help me solve? and can you explain neatly and clearly? will rate, thank you. 1. In this experiment, you will be generating time measurements that have both random uncertainty (Stran) and systematic uncertainty (dtsys). Using Eq. 4 as a starting point, write down an equation that will allow you to calculate &t from Stran and otsys 2. The acceleration due to gravity is related to the time, t, it takes the...

  • Please help, I am very confused. I do not know where to start. Please show work...

    Please help, I am very confused. I do not know where to start. Please show work and explain. THANK YOU SO MUCH For a charge +25 uC: a. Rank the electric energy between Q and q for a charge q = +10 μC placed at points A-E Largest- 1._2_ 4 6.-Smallest b. Rank the electric energy between Q and q for a charge q +3 uC placed at points A-F _456.Smallest c. Rank the electric energy between Q and q...

  • Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS:...

    Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS: it is for a yahtzee game program. Write function sumChance to do the following a. Return type int b. Parameter list array of dice c. Declare int variable sum d. Declare int variable die e. Loop through the dice array adding the value of each die to the variable sum f. Return variable sum Write function checkLgStraight to do the following a. Return type...

  • Please help I am confused to where start. It C++ program thank you The stoi function...

    Please help I am confused to where start. It C++ program thank you The stoi function converts a string to an integer, but does not check whether or not the value of the string is a good integer. If the stoi function fails, an exception is thrown and the program terminates. Write a program that asks the user to enter two strings, one called sNumerator and the other sDenominator. Using the stoi function, convert the two strings to numbers but...

  • My Question is: I have to modify this program, even a small modification is fine. Can...

    My Question is: I have to modify this program, even a small modification is fine. Can anyone give any suggestion and solution? Thanks in Advanced. import java.util.*; class arrayQueue { protected int Queue[]; protected int front, rear, size, len; public arrayQueue(int n) { size = n; len = 0; Queue = new int[size]; front = -1; rear = -1; } public boolean isEmpty() { return front == -1; } public boolean isFull() { return front == 0 && rear ==size...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT