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
A network utilizes a network access control (NAC) solution to protect against malware. When a wired or wireless host tries to co
Inessa [10]

Answer: Posture assessment

Explanation:

Posture assessment, also refers to posture validation and it is when somw set of rules are applied to the posture data which then gives an assessment of the trust level which can be placed in th e endpoint.

Posture assessment has to do with how the system security is evaluated based on the applications and the settings.

3 0
3 years ago
A___________is a collection of computer software, typically malicious, designed to enable access to a computer or an area of its
Molodets [167]

Answer: rootkit

Explanation:

Hi, A rootkit is a collection of computer software, typically malicious, designed to enable access to a computer or an area of its software that is not otherwise allowed (for example, to an unauthorized user) and often masks its existence or the existence of other software.

A rootkit provides continued privileged access to a computer while hiding its presence. Because of this hiding characteristic it is very difficult to detect.

Once a rootkit has been installed, it allows someone to have total remote control of a computer and do things such as files executions and system changes.

4 0
3 years ago
Write the name of the tab, command group, and icon you need to use to access the borders and shading dialog box.
Ilia_Sergeevich [38]

Answer:

Tab: Home Tab

Command group: Paragraph

Icon: Triangle

Explanation:

7 0
3 years ago
Intellectual property does not include which of the following
liq [111]
I'd have to say C. the steel as this is very physical as the others aren't as much which makes it stand out 
8 0
3 years ago
Which operating system became obsolete with the arrival of more advance graphical user interfaces
jarptica [38.1K]
MS-DOS. MS-DOS stands for Microsoft Disk Operating System. It was the first widely installed operating system for personal computers but became obsolete with the arrival of more advanced graphical user interfaces such as MAC OS developed by Apple, Inc.

Good Luck!
8 0
2 years ago
Other questions:
  • Computers are said to use binary data because all computer data is simply a series of Os and 1s.
    10·1 answer
  • Without a well-designed, accurate database, executives, managers, and others do not have access to the ____________________ they
    15·1 answer
  • What is one of the benefits of using templates for your email marketing campaigns?
    10·1 answer
  • 1 Point
    14·1 answer
  • The true or false questions.
    13·1 answer
  • when I was playing Mobile legends bang bang online Match The game logged Me out and when I was Trying To reconnect it failed and
    5·1 answer
  • Which business case is better solved by Artificial intelligence than conventional programming?<br>​
    8·1 answer
  • Which of these is NOT an example of lifelong learning?
    6·1 answer
  • Question 4
    5·1 answer
  • Assume that the Vehicle class contains a virtual method named CalculateMaxSpeed(). Assume that both the MotorVehicle and Automob
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!