answer.
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
Kipish [7]
2 years ago
9

5.15 LAB: Output values below an amount Write a program that first gets a list of integers from input. The input begins with an

integer indicating the number of integers 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. Assume that the list will always contain fewer than 20 integers. 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.

Computers and Technology
2 answers:
qaws [65]2 years ago
7 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:

IgorC [24]2 years ago
5 0

Answer:

# the terminal display waiting for the user to enter the input

# the received input is assigned to user_input

user_input = input()

# the user_input is splitted based on space and is assigned to integerlist

integerlist = user_input.split(" ")

# the last element in the integerlist is assigned as threshold

threshold = int(integerlist[len(integerlist) - 1])

# a for loop that loop from index 1 to second to the last element in the list

# the loop compare each element with the threshold

# if element is less than threshold, it is displayed

# the loop start from index 1 because index 0 represent number of element

for i in range(1, (len(integerlist) - 1)):

       if int(integerlist[i]) < threshold:

           print(integerlist[i], sep="")

Explanation:

The program is written in Python and well commented.

An sample of program output when it is executed is attached.

You might be interested in
To keep a desktop computer or a server powered up when the electricity goes off in addition to protection against power fluctuat
pickupchik [31]

To keep a desktop computer or a server powered up when the electricity goes off in addition to protection against power fluctuations, an <u>uninterruptible power supply (UPS)</u>, which contains a built-in battery, can be used.

<u>Explanation</u>:

An uninterruptible power supply (UPS) is a device that allows a computer or server powered up for a short time, when the electricity goes off. UPS device also provides uninterrupted service during power fluctuation.

A battery is inbuilt in the UPS and provides power for few minutes to the computer to shut down it in a proper manner.

UPS is available at affordable cost and can be maintained at low cost compared to generators.

8 0
1 year ago
Read 2 more answers
Which of the following are examples of algorithms? (Select all that apply, if any do.)
Travka [436]

Answer:

A. The mathematical formula for finding the area of a circle.

D. Instructions for setting up a new DVD player

E. A series of steps that moves a "lighting bot" around to turns on lights.

Explanation:

Algorithm is a systematic procedure (or process) that produces the answer to a question or the solution of a problem in a finite number of steps.

Option A is an algorithm. The mathematical formula for finding the area of a circle gives a solution to a problem. The problem is finding area of a circle and the formula gives the step by step procedure finding the area of a circle.

Option B is not an algorithm. Option B just provide a list of your favourite animals and it doesn't answer a question we know about.

Option C is not an algorithm. A problem statement is still a problem with no solution whereas algorithm provides solution

Option D is an algorithm. It provides the step by step procedures for setting up a new DVD player

Option E is an algorithm. It provides a series of steps that moves a lighting bot around to turns on lights, so it provides a solution.

4 0
2 years ago
Read 2 more answers
Write a script to check command arguments (3 arguments maximum). Display the argument one by one. If there is no argument provid
serious [3.7K]

Answer:-args (

if:args=true

-cont

if:args=false

-cont investigating

if:args=irrelevance

-loop restate args

)

compile exec

Explanation:

7 0
1 year ago
Match each vocabulary word to its definition.
ycow [4]
<h2>Answer:</h2>

Following are the vocabulary words matched to their definitions:

1. Command:

Instructions that tell a computer  what to do.

Pressing a single button such enter key can also be said as command. So command is any instruction that tells a computer to perform specific action.

2. Desktop

The background screen on a computer.

When the computer is turned ON, the screen we see the first is the Desktop. It has several icons that lead to different folders and files.

3. GUI

Rectangular area on a computer screen where the action takes place performing more than one activity at a time.

GUI stands for Graphical User Interface. It is an interface that allows to create application that may run using icons and labels instead of text commands

4. Menu

List of commands.

A menu is a drop down list that allows us to choose a command from the present ones. Menus are used vastly. For example: Simply a right clicking on computer's screen we see a menu having commands for arranging of icons as well as refreshing.

5. Multitasking

Interface that enables users to easily interact with their computers.

Multitasking allows the users to perform more than one task at a time. Multitasking helps to save time.

6. Window

The main work area.

The opened pane o any program is termed as a window. work is done inside the window of the program.

<h2>I hope it will help you!</h2>
4 0
1 year ago
Read 2 more answers
Given 4 integers, output their product and their average, using integer arithmetic.
solmaris [256]

Answer:

see explaination

Explanation:

Part 1:

import java.util.Scanner;

public class LabProgram {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int num1;

int num2;

int num3;

int num4;

int avg=0, pro=1;

num1 = scnr.nextInt();

num2 = scnr.nextInt();

num3 = scnr.nextInt();

num4 = scnr.nextInt();

avg = (num1+num2+num3+num4)/4;

pro = num1*num2*num3*num4;

System.out.println(pro+" "+avg);

}

}

------------------------------------------------------------------

Part 2:

import java.util.Scanner;

public class LabProgram {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int num1;

int num2;

int num3;

int num4;

double avg=0, pro=1; //using double to store floating point numbers.

num1 = scnr.nextInt();

num2 = scnr.nextInt();

num3 = scnr.nextInt();

num4 = scnr.nextInt();

avg = (num1+num2+num3+num4)/4.0; //if avg is declared as a float, then use 4.0f

pro = num1*num2*num3*num4;

System.out.println((int)pro+" "+(int)avg); //using type conversion only integer part

System.out.printf("%.3f %.3f\n",pro,avg);// \n is for newline

}

}

8 0
1 year ago
Other questions:
  • The overall purpose of CSS is to modify the way web pages look without modifying the underlying HTML code. way tables render in
    12·2 answers
  • A slide contains three text boxes and three images that correspond to the text boxes. Which option can you use to display a text
    5·2 answers
  • When performing actions between your computer and one that is infected with a virus which of the following offers no risk becomi
    5·1 answer
  • What three requirements are defined by the protocols used in network communications to allow message transmission across a netwo
    11·1 answer
  • Explain why each of the following names does or does not seem like a good variable name to represent a state sales tax rate.
    14·1 answer
  • Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
    11·1 answer
  • Return 1 if ptr points to an element within the specified intArray, 0 otherwise.
    7·1 answer
  • 4.17 LAB: Data File A comma separated value (.csv) file has been included to be used for this program. Each line contains two va
    13·1 answer
  • When using the Python shell and code block, what triggers the interpreter to begin evaluating a block of code
    14·1 answer
  • HackerCards is a trendy new card game. Each type of HackerCard has a distinct ID number greater than or equal to 1, and the cost
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!