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 help me solve this? I need to return a single list. Not 2 separate...

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

  • Based on the following examples of function calls and the respective return values, guess what are...

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

    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')

  • 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?

  • can some help me why it is erroring. I cannot find the mistake in the code....

    can some help me why it is erroring. I cannot find the mistake in the code. It is to implment a circular double linked list. please and thank you ////////////////////////////////////////////////////////////////////////// HEADER FILE //////////////////////////////////////////////////////////////////////// #pragma once #include <cstdlib> template <typename T> class Node { public:    T val;    Node<T> *next;    Node(T v)    {        val = v;        next = NULL;    } }; /////////////////////////////////////////////////////////////////////////////////// STACK.CPP FILE /////////////////////////////////////////////////////////////////////////////////// #include "Stack.h" template <typename T> class Stack {...

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

  • 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");...

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

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