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
What does mean I can’t turn on my computer and my computer won’t charge at all
Dmitrij [34]

Explanation:

well that happened to me to and what my dad did was to cut the cable and fix it,it worked.Ithink my situation is very different than yours but you cantiue to see what else it says and if you want to you can text me back.

5 0
3 years ago
Access Office Equipment has shifted to sales and service of laptops and PCs, where it has the potential to triple the number of
AleksAgata [21]

Answer:

Access Office Equipment is implementing a growth strategy.

Explanation:

Growth strategy can be defined as the strategy whose goal is to win market shares in a greater quantity. The earnings in growth strategy might be short-termed. The common growth strategies include:

  • product expansion
  • market expansion
  • market penetration
  • acquisition and diversification

I hope it will help you!

4 0
3 years ago
The percentage of typical calls that would reach a respondent eligible to participate in a project is called the
Anna35 [415]

The percentage of the calls that would reach a respondent eligible to participate in a project is called the Response rate (survey) .

<h3>What is Response rate (survey)?</h3>

In survey research, the response rate is called the return rate as it is said to be the number of people who are said to have answered the survey divided by the total number of population.

Note that The percentage of the calls that would reach a respondent eligible to participate in a project is called the Response rate (survey) .

Learn more about project from

brainly.com/question/25009327

#SPJ1

3 0
2 years ago
What runs horizontally and is identified with numbers?
kramer
D. the answer is Column 
6 0
3 years ago
Read 2 more answers
PLEASE ANSWER LAST DAY OF SCHOOL. Discussion Topic
meriva

Answer:

You can't really say it matters whether it's short or long

Explanation:

There several coding language some short and some long with different purposes so it doesn't really make a difference

Although some coders have been able to shorten some codes so I'd say shorter is faster and be[er and easier to memorize

Thanks hope I was helpful

4 0
2 years ago
Other questions:
  • Computers that belong to the same domain can access a common security database of user and computer account information. This ty
    5·1 answer
  • What is anatomy of software house?
    10·1 answer
  • Using 2 bytes, how many different characters can Unicode represent?
    14·1 answer
  • Why would you use quotation marks in a search string when conducting an internet search?
    12·1 answer
  • I like to troll what about you
    10·1 answer
  • Web design and development tools
    13·1 answer
  • When you login to your blogging account. The first screen with all controls, tools and functions is called .... Select one: a. D
    10·1 answer
  • Implement the ArrayMethod application containing an array that stores eight integers. The application should call the following
    12·1 answer
  • Match the following pls help
    5·1 answer
  • Which directory contains the initrd file? in suse linux
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!