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
frosja888 [35]
2 years ago
12

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, which indicates a threshold. Output all integers less than or equal to that last threshold value.
Computers and Technology
2 answers:
Dafna11 [192]2 years ago
4 0

Answer:

def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):

 for value in user_values:

     if value < upper_threshold:

         print(value)  

def get_user_values():

 n = int(input())

 lst = []

 for i in range(n):

     lst.append(int(input()))

 return lst  

if __name__ == '__main__':

 userValues = get_user_values()

 upperThreshold = int(input())

 output_ints_less_than_or_equal_to_threshold(userValues, upperThreshold)

Explanation:

meriva2 years ago
3 0

Answer:

package b4;

import java.util.Scanner;

public class TresholdValue {

public static void main(String[] args) {

 // Create an object of the Scanner class to allow for user's input

 Scanner input = new Scanner(System.in);

 // Create a prompt to allow users to enter the set of integers

 System.out.println("Please enter the set of integers, each followed by a space : ");

 // Get the first integer from the set of inputs.

 // Parse the input and convert it into an integer

 // by using the Integer.parseInt() method.

 // Store the result in an integer variable.

 int first = Integer.parseInt(input.next());

 // Create an integer array to hold the other numbers (first number excluded).

 // The array should have a length equal in value to the first number in the set.

 // This has been stored in a variable called "first".

 int[] intarray = new int[first];

 // Create a while loop that populate the intarray with the set of numbers

 int i = 0;

 while (input.hasNext() && i < intarray.length) {

  intarray[i] = Integer.parseInt(input.next());

  i++;

 }

 // Get the last value (threshold) from the intarray.

 // The threshold value is the last element in the array.

 int lastvalue = intarray[intarray.length - 1];

 // Create a prompt before displaying the set of values that are less than or

 // equal to the threshold value.

 System.out.println("Values less than or equal to the threshold value (" + lastvalue + ") are : ");

 // Create a loop to cycle through the array.

 // At each cycle, the element is checked if or not it is less than or equal to

 // the threshold value.

 // If it is less than or equal to, the number is printed.

 for (int j = 0; j < intarray.length - 1; j++) {

  if (intarray[j] <= lastvalue) {

   System.out.print(intarray[j] + " ");

  }

 }

 // (Optional) Close the Scanner object to prevent resource leak

 input.close();

}

}

Explanation:

The program has been written in Java. The source code file has been attached to this response. Please download it for better readability. The code contains comments explaining what goes on on each segment of the code.

Hope this helps!

Download java
You might be interested in
Are the actions legal or illegal?
garik1379 [7]

Answer:

No, Company will not pay

Explanation:

At the last point of the final deal, any significant sum of money does not fall into the frame.

It was important to address the exact amount needed to update the research on agriculture. They might be asking for inflated amounts.

3 0
3 years ago
A user's computer will not boot. A technician notices four indicator lights on the backside of the
vaieri [72.5K]

Answer:

B.

Explanation:

Computer manual is the user guide that comes along with the computer set to inform the users about the functions, ways to assemble the parts, and so on.

The user manual consists of guide for the users specially for electronic products such as computers, refrigerators; softwares, and so on. These manuals are written by technical writers, programmers, etc.

<u>In the given scenario the technician needs to refer to computer manual to know the meaning of the lights on the backside of the computer.</u>

So, the correct answer is option B.

6 0
2 years ago
What are the differences between a cursor, insertion point and mouse pointer?​
Anna35 [415]

Answer:

Explanation:

A cursor is a pointer which indicates the position of the mouse on a computer's display monitor.

An insertion point is a location in a document where additional information is inserted when the user begins to type.

A mouse pointer is an image used to activate/control certain elements in a GUI (graphical user interface).

I know you asked for the differences, though i thought I'd add a similarity. All of these 3 things are similar, as they show where the position of the info/mouse is. :)

Hope this helps!

-Biscuit08

7 0
2 years ago
When an event occurs, the agent logs details regarding the event. what is this event called?
Nimfa-mama [501]

If an event occurs, the agent logs details regarding the event. what is this event called GET.

The information in the agent log file is known to be the beginning of the log file, which is stated to show the agent's launch and handling of the services and configuration settings.

Keep in mind that the agent log also contains a history of the activities performed by the agent during runtime, along with any errors, and that it is utilised to investigate deployment issues.

As a result, if an event happens, the agent logs information about it. What is this GET event, exactly?

The agent monitoring services' startup and configuration settings are displayed at the log file's beginning. The sequence of agent runtime activity and any observed exceptions are also included in the agent log.

Learn more about agent logs:

brainly.com/question/28557574

#SPJ4

8 0
1 year ago
Which type of communication protocol converts data into standard formats that can be used by applications?
larisa86 [58]
<span>Arrival protocols are the type of data protocols that convert data into standard formats that can be used by applications, such as email, Web browsers and Skype</span>
8 0
3 years ago
Other questions:
  • What is something you can do to stay connected to the relationships in your life while we spend this time at home?
    13·1 answer
  • You should use html elements instead of server controls when
    11·1 answer
  • What do we call the time it takes for all of the sub-pixels on the panel to go from pure black to pure white and black again
    6·1 answer
  • In terms of data storage and sharing, in what way, if any, do dropbox services differ from archiving services?
    8·1 answer
  • To more easily incorporate methods into a program, it is common practice to store methods in their own classes and files. Then y
    6·1 answer
  • Which of the following lists the proper order of the categories of the SOC system from general to specific?
    11·1 answer
  • Clarissa is a computer programming consultant. When a client states that they have an extremely complex programming task, which
    10·2 answers
  • Gimme Shelter Roofers maintains a file of past customers, including a customer number, name, address, date of job, and price of
    8·1 answer
  • This code --&gt; plt.plot(x,y) is used to draw :
    8·1 answer
  • . Question 2 Fill in the blank: R Markdown notebooks can be converted into HTML, PDF, and Word documents, slide presentations, a
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!