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 three options below describe typographic hierarchy?
Korvikt [17]

The three options that describe the typographic hierarchy are given below:

  • The importance of information is shown through the text.
  • The presentation of the text in terms of structure.
  • The placement of the text defines its flow and hierarchy.

Thus, the correct options are A, B, and C.

<h3>What is Typographic hierarchy?</h3>

Typographic hierarchy may be characterized as an approach that utilizes typography: the size, font, and layout of distinct text components to produce a hierarchical division that can authenticate users where to look for specific information.

The purpose of using this methodology is to focus on the main points of the article accordingly. It increases the sense of understanding of the readers with focus.

Therefore, it is well described above.

To learn more about Typographic hierarchy, refer to the link:

brainly.com/question/12076206

#SPJ1

3 0
2 years ago
Jennifer has written a short story for children. What should be her last step before she submits the story for publication?
SSSSS [86.1K]

Answer:

What is the choice of being answer c?

6 0
4 years ago
Help me help you............
KiRa [710]

Answer:

change how big or small the shape or sprite is

6 0
2 years ago
What is a close syllable
Tasya [4]
A closed syllable<span> is a </span>syllable<span> that ends with a consonant. The words fan, am, and left have </span>closed syllables<span>. Multi-syllabic words have </span>closed syllables<span> too. For example, a two-</span>syllable<span> word with the vowel-consonant-consonant-vowel pattern may have one or two </span>closed syllables<span>.</span>
5 0
3 years ago
Read 2 more answers
Which options are available when a user modifies a recurring appointment? Check all that apply. Open this occurrence Open the fi
Rus_ich [418]

Open this occurence and open the series is the two options to choose from, from the dialog box that shows when attempting to modify the appointments

4 0
4 years ago
Read 2 more answers
Other questions:
  • Where is the error in this code sequence?
    11·1 answer
  • There is no reason to study the works of famous photographers because they will make you less creative.
    5·2 answers
  • A certain database has numerous tables, but they do not share any fields in common. this database will not be as powerful as oth
    15·2 answers
  • How is a correction made to an Electronic health record?
    14·1 answer
  • ________ programming is a method of writing software that centers on the actions that take place in a program.
    8·1 answer
  • can anyone sub to my youttube channel pls, its called Yakobu, and Im trying to reach 100 subs by the end of the month :)
    9·1 answer
  • Does analogue conversation take place in source as transmitter?
    5·2 answers
  • Role of User Defined Iprms for creation of paten
    8·1 answer
  • What's the difference between an operating system and an application software?​
    6·1 answer
  • Select the correct answer from the drop-down menu. Olivia composed a layout with the image below for a seasonal greeting card. W
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!