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
myrzilka [38]
3 years ago
11

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer

s that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75 The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. Such functionality is common on sites like Amazon, where a user can filter results. Your code must define and call the following two functions: def get_user_values() def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold)
Computers and Technology
1 answer:
oksano4ka [1.4K]3 years ago
7 0

Answer:

The program in Python is as follows:

def get_user_values():

   user_values = []

   n = int(input())

   for i in range(n+1):

       inp = int(input())

       user_values.append(inp)

   output_ints_less_than_or_equal_to_threshold(user_values,user_values[n])

def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):

   for i in user_values:

       if i <= upper_threshold:

           print(i,end=" ")

           

get_user_values()

Explanation:

This defins the get_user_values() method; it receives no parameter

def get_user_values():

This initializes user_values list

   user_values = []

This gets the number of inputs

   n = int(input())

This loop is repeated n+1 times to get all inputs and the upper threshold

<em>    for i in range(n+1):</em>

<em>        inp = int(input())</em>

<em>        user_values.append(inp)</em>

This passes the list and the upper threshold to the output..... list  output_ints_less_than_or_equal_to_threshold(user_values,user_values[n])

This defines the output.... list

def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):

This iterates through the list

   for i in user_values:

If current element is less or equal to the upper threshold, the element is printed

<em>        if i <= upper_threshold:</em>

<em>            print(i,end=" ")</em>

The main method begins here where the get_user_values() method is called

get_user_values()

You might be interested in
According to the Big Five Factors model, all but _____ are categories.
STatiana [176]
The Big Five Factors are: "Open, Agreeable, Stable, Conscientious, and Extraverted"

"Empathetic" is not one of the Big Five Factors.

<span>According to the Big Five Factors model, all but empathetic are categories.</span>
4 0
3 years ago
A call center is a _______.<br><br> JIT<br><br> CMA<br><br> CIC<br><br> SFA
sp2606 [1]

Answer: CIC

Explanation:

A call center is a customer interaction center (CIC) and it is the interface between call center agent with the customers directly. CIC are connected by the external telephone system and it uses as call center.

And the caller are basically identify by the telephone number and customer information are display in the CIC.

CIC are the modular structure for communication which include various components of CIC and framework.

4 0
3 years ago
I need an answer fast !!! (APEX)
lana [24]
Your answer is B)<span>The Intel 4004</span>
3 0
3 years ago
Which symbol would be used in a flowchart to represent a connection to another part of the flowchart
Lisa [10]
The answer is an arrow
3 0
3 years ago
A customer dictates instruction on how to transcribe audio. Do you have to transcribe the instruction word for word?
Ostrovityanka [42]

Answer:

No

Explanation:

4 0
2 years ago
Other questions:
  • If a user wants to change one small section of the formatting of a document and leave the rest the same, which process should be
    14·1 answer
  • 2. Statement: "I don't agree with you." Nonverbal gesture: Type of gesture:
    6·1 answer
  • Your boss bought a new printer with a USB 3.0 port, and it came with a USB 3.0 cable. Your boss asks you:
    7·2 answers
  • Write java code that displays all the objects in a stack in the order in which they were pushed onto it. after all the objects a
    5·1 answer
  • You are the leader of a team at work. What type of leader would you like to be – one that gets involved and works with the team
    15·2 answers
  • Is media good for the brain?
    7·2 answers
  • This is for career exploration, I need help please! &lt;3 HELPPPP
    8·2 answers
  • Write code which takes two inputs from the user, a number of sides followed by a side length, then creates a regular polygon wit
    10·2 answers
  • How do you put text in MS publisher?<br><br> When do you use text wrapping?
    14·1 answer
  • You have implemented an access control method that only allows users who are managers to access specific data. Which type of acc
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!