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
Zepler [3.9K]
2 years ago
6

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) Utilizing functions will help to make your main very clean and intuitive. Note: This is a lab from a previous chapter that now requires the use of functions LAB ACTIVITY 4331. LAB: Output values in a list below a user defined amount -functions 0/10
Computers and Technology
1 answer:
dalvyx [7]2 years ago
4 0

Answer:

The program is as follows:

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=" ")

           

def get_user_values():

   user_values = []

   n = int(input())

   for i in range(n):

       num = int(input())

       user_values.append(num)

   

   upper_threshold = int(input())

   output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold)

get_user_values()

Explanation:

This defines the output_ints_less_than_or_equal_to_threshold method

def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):

This iterates through user_values

   for i in user_values:

For every item in user_values

       if i <= upper_threshold:

This prints all items less than or equal to the upper threshold

           print(i,end=" ")

           

This defines get_user_values method

def get_user_values():

This creates an empty list

   user_values = []

This gets the number of inputs

   n = int(input())

This iterates through n

   for i in range(n):

This gets input for every item of the list

       num = int(input())

This appends the input to the list

       user_values.append(num)

This gets input for upper threshold    

   upper_threshold = int(input())

This calls output_ints_less_than_or_equal_to_threshold method

   output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold)

The main begins here; This calls get_user_values method

get_user_values()

You might be interested in
What do you think is the most important factor affecting the collection of digital data and what impact do you think that this f
borishaifa [10]

<u>Answer:</u>

<u>Privacy concerns.</u>

<u>Explanation:</u>

Privacy concerns have played an important role in how we collect digital data. For example, privacy activists believe that an individual has the right to know how his or her information is being used and that such an individual also has the right to withhold such information.

Such issues have affected the ability of law enforcement agencies to investigate criminal activities. For example, an individual who is accused of a crime may claim a <em>right to withhold his personal information, such as his mobile device, and thus he refuses to give out such information.</em>

4 0
3 years ago
The "edit" command must allow the user to find a record in the list by director. If there are multiple records with the same dir
sveticcg [70]

Answer:

To allow user to assign rating

Explanation:

The basic function of “rate” command is to give opportunity to the user to assign a value to a song from the range of 1 – 5.

In the range, the value of 1 indicates the lowest rating, while value of 5 is the highest rating that can be obtained.

Any previous ratings are then replaced by the new rating assigned from the range of 1 – 5.

7 0
3 years ago
A company wants to use online methods to target more customers. It decides to conduct a market research by collecting the data o
Ronch [10]

Answer:

They could use a CRM

A CRM tool lets you store customer and prospect contact information, identify sales opportunities, record service issues, and manage marketing campaigns, all in one central location — and make information about every customer interaction available to anyone at your company who might need it.

They Could Use PDC

The term “primary data” refers to data you collect yourself, rather than data you gather after another party initially recorded it. Primary data is information obtained directly from the source. You will be the first party to use this exact set of data.

They Could Use Quantitative vs. Qualitative Data

Quantitative data comes in the form of numbers, quantities and values. It describes things in concrete and easily measurable terms. Examples include the number of customers who bought a given product, the rating a customer gave a product out of five stars and the amount of time a visitor spent on your website.

Why Should I Track Users Data:

To ensure it's going smoothly, it's important to keep track of data that directly correlates to the potential success of your business. Key performance and financial metrics can help you address any problems with your business before they occur

8 0
2 years ago
Which option in a Task element within Outlook indicates that the task is scheduled and will be completed on a later date?
dalvyx [7]

Answer:

in progress

Explanation:

it is being answered by the person

3 0
2 years ago
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject afte
Marina86 [1]
The correct answer for this question is this one: "She can rename the 2 worksheet by right clicking the sheet tab. After right clicking the mouse, select Rename Sheet and type the preferred name of the sheet."  Hope this helps answer your question and have a nice day ahead.
5 0
3 years ago
Read 2 more answers
Other questions:
  • What are the benefits of organizing your thoughts before you begin your speech
    14·1 answer
  • What is the definition of a WAP?
    6·2 answers
  • Enter a formula in cell b7 to calculate the average value of cells b2:b6
    13·1 answer
  • Who has access to the source code of proprietary software
    6·1 answer
  • You can use the Ignore All button to ignore the current and all future occurrences of a flagged word. True or False
    5·1 answer
  • The Internet began when a large company wanted to sell products online. <br> True or flase?
    6·2 answers
  • What is internet marketing??
    13·1 answer
  • Which of the following statements about security in the network is true?
    15·1 answer
  • Using complete sentences post a detailed response to the following.
    10·1 answer
  • ????????????helpppp please
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!