1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vladimir2022 [97]
3 years ago
9

6. Larger Than n In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contain

s numbers. The function should display all of the numbers in the list that are greater than the number n.
Computers and Technology
1 answer:
Reika [66]3 years ago
6 0

Answer:

The solution code is written in Python

  1. def largerThanN(myList, n):
  2.    output = ""
  3.    for x in myList:
  4.        if(x > n):
  5.            output += str(x) + " "
  6.    
  7.    print(output)
  8. l = [5, 12, 11, 4, 56, 32]
  9. n = 15
  10. largerThanN(l, n)

Explanation:

Firstly, create a function largerThanN that accepts two arguments, a list (myList) and a number (n) (Line 1).

Next, create a output variable to hold the string of numbers in the list that are greater than the input number n (Line 2).

Create a for loop to traverse through each number in the list and then check if the current x is bigger than n. If so concatenate the x to output string along with a single space " " (Line 4 -6)

After the loop, print the output string (Line 8)

We test the function by using a sample list and n = 15 (Line 10 - 12). The program will display 56 32 .

You might be interested in
Which is a example of fixed expense <br><br> -food<br> -clothing<br> -entertainment<br> -rent
Artemon [7]
Salutations!

<span>Which is an example of fixed expense?

Rent is an example of fixed expense, It doesn't matter whether you sell a widget or produce thousand of them, you must still pay the rent in any </span><span>circumstances.
</span>
Hope I helped.
6 0
4 years ago
Read 2 more answers
Is this correct? I say its B, but my friend says its D.
kari74 [83]

Answer:

b

Explanation:

4 0
3 years ago
Read 2 more answers
Return a formatted string with numbers The function below takes three numerical inputs: num1, num2, and num3. Implement it to re
alexira [117]

Answer:

In Python:

def ret_formatted(num1,num2,num3):

   result = str(num1)+"_"+str(num2)+" ! "+str(num3)

   return result

Explanation:

This defines the function

def ret_formatted(num1,num2,num3):

This generates the output string

   result = str(num1)+"_"+str(num2)+" ! "+str(num3)

This returns the result string

   return result

3 0
3 years ago
Change the function definition for myint so that xyzfunc uses the same memory locations for myint as in the calling program.
sattari [20]

Answer:

b) void xyzfunc (int &myint);

Explanation:

To use the same memory location as the variable in the calling function we have to pass the variable by reference means passing the same address to the function.So to do that we have use & operator which stands for address.

We will do this as following:-

void xyzfunc (int * myint);

Hence the answer is option b.

8 0
4 years ago
Which option is used in order to configure switchboards for a complex database?
Ostrovityanka [42]

Answer:

switch board manager

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Ryan wants to ensure that all the words in this document are evenly spaced so that they look neat and readable . Which option in
    12·1 answer
  • Which one of the following oscilloscope controls is used to move the trace up and down the screen vertically? A. Focus B. Sweep
    9·2 answers
  • A radiologist’s computer monitor has higher resolution than most computer screens. Resolution refers to the:______
    15·1 answer
  • Which flowchart symbol indicates the start or the end of a process?
    8·1 answer
  • What is a Network It’s a system that is used to link two or more computers and name the different types of networks.?
    11·1 answer
  • Write the simulate method, which simulates the frog attempting to hop in a straight line to a goal from the frog's starting posi
    10·1 answer
  • 11.5 Code Practice edhesive
    10·2 answers
  • Can you please help me?
    6·1 answer
  • List 10 ways how can graphic design help the community
    13·1 answer
  • What is professional education? <br><br><br><br><br>Please help me to do this.​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!