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]
2 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]2 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
Html xml and xhtml have descended from the original ____________________ specification
ioda
<span>Html xml and xhtml have descended from the original SGML (I think it's Standard Generalized Markup Language) specification.</span>
7 0
2 years ago
7. Is processing an action being done to a data? (1 Point) O True O False​
vivado [14]

Explanation:

Data is processed into information. Information is not processed into data

5 0
1 year ago
What does it mean when a return is rejected for code 0503?
GarryVolchara [31]
Reject Code 0503<span> indicates that the Spouse's Social Security Number and the first 4 letters of the spouse's last name </span>do<span> not match IRS records. The IRS uses data provided by the Social Security Administration to verify this information. Hope this helps.</span>
5 0
2 years ago
Mation about which osi layers of connected cisco devices can be verified with the show cdp neighbors comm
fgiga [73]
The show CDP neighbor command operates at the Data link layer (Layer 2)

Cisco Discovery Protocol (CDP) is a proprietary Data Link Layer protocol developed by Cisco Systems. It is used to share information about other directly connected Cisco equipment, such as the operating system version and IP address.

6 0
2 years ago
A set of instructions to increase a programmer’s pay rate by 10 percent is hidden inside an authorized program. It changes and u
guajiro [1.7K]

Answer:

c) Trojan horse

Explanation:

A Trojan horse is designed to damage, disrupt, steal, or in general inflict some other harmful action on your data or network. A Trojan acts like a bona fide application or file to trick you. Once installed, a Trojan can perform the action it was designed for.

If a set of instructions to increase a programmer’s pay rate by 10 percent is hidden inside an authorized program and it changes and updates the payroll file, then this instructions called a Trojan horse.

A  trap door, also known as a back door, provides a secret or undocumented method of gaining access to an application, operating system or online service.

A virus worm is a malicious, self-replicating program that can spread throughout a network without human assistance

4 0
2 years ago
Other questions:
  • Janet has created an original musical composition, recorded it on a CD and registered her work online. Which law will protect he
    10·1 answer
  • Modify an array's elements using other elements Write a for loop that sets each array element in bonusScores to the sum of itsel
    7·1 answer
  • Consider a situation where we have a file shared between many people.  If one of the people tries editing the file, no other pe
    6·1 answer
  • When a user attempts to visit an internet-based web server, what is the default action of the windows firewall?
    10·1 answer
  • Rock climbing fun html
    12·1 answer
  • You are testing a site and realize that when you click a graphic link you see an outline but no picture. What is wrong with the
    5·1 answer
  • Differentiate agricultural waste from hazardous waste.​
    9·1 answer
  • Write a 5 – 7+ sentence paragraph about Thanksgiving that DOES NOT use the letter “t.”
    10·1 answer
  • Which protocol uses a hierarchy to connect individual groups to a network backbone?.
    9·1 answer
  • You hide three worksheets in a workbook and need to unhide them. What is an accurate statement about this process?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!